HTML link with a php action -


i creating website stores information of homes address, city etc. got upload database part done , got search database , display information done.

but plan search results , there suppose option view full profile of home via link. displaying full profile information gathered database done through separate php file. when link php file display last column in database. how can link when click on "view full profile" connect correct data/profile corresponds different address or price. or if cant use html link can use? impossible?

here code displays search results have been able search database , display it

    <?php if($sql->num_rows){     while ($row = $sql->fetch_array(mysqli_assoc)){         echo '<div id="listing">                     <div id="propertyimage">                          <img src="images/'.$row['imagename1'].'" width="200" height="150" alt=""/>                      </div>                      <div id="basicinfo">                     <h2>$'.$row['price'].'</h2>                     <p style="font-size: 18px;"># '.$row['streetaddress'].', '.$row['city'].', bc</p>                     <p>'.$row['numbed'].' bedrooms | '.$row['numbath'].' bathrooms | '.$row['property'].'</p>                     <br>                     <p><a href="outputtest.php" class="link2">view full details</a> | <a href="services/services.html" class="link2">get directions</a>                      </div>                 </div>';          height="150" alt=""/>';       } } else { echo '<h2>0 search results</h2>'; } ?> 

here php display information outputtest.php

<?php mysql_connect("localhost","root","31588patrick"); @mysql_select_db("test") or die( "unable select database"); $query="select * propertyinfo"; $result=mysql_query($query);  $num=mysql_numrows($result);  mysql_close();    $i=0; while ($i < $num) {  $varstreetaddress=mysql_result($result,$i,"streetaddress"); $varcity=mysql_result($result,$i,"city"); $varproperty=mysql_result($result,$i,"property"); $varnumbed=mysql_result($result,$i,"numbed"); $varnumbath=mysql_result($result,$i,"numbath"); $varprice=mysql_result($result,$i,"price"); $varemail=mysql_result($result,$i,"email"); $varphone=mysql_result($result,$i,"phone"); $varutilities=mysql_result($result,$i,"utilities"); $vartermlease=mysql_result($result,$i,"termlease"); $varnotes=mysql_result($result,$i,"notes"); $image1=mysql_result($result,$i,"imagename1"); $image2=mysql_result($result,$i,"imagename2"); $image3=mysql_result($result,$i,"imagename3"); $image4=mysql_result($result,$i,"imagename4");    $i++; }  ?> html code go after 

thanks

edit working

    <?php  ////////////using mysqli connect database  $mysqli = new mysqli("localhost","root","31588patrick", "test");         if ($mysqli->connect_errno) {             echo "failed connect mysql: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;         } ///////////set variables $record_id = $_get['record_id'];  $sql = $mysqli->query("select * propertyinfo streetaddress '%$record_id%'");  if($sql === false) {     die(mysql_error()); // todo: better error handling  }   if($sql->num_rows){     while ($row = $sql->fetch_array(mysqli_assoc)){         $varstreetaddress=$row['streetaddress'];         $varcity=$row['city'];         $varproperty=$row['property'];         $varnumbed=$row['numbed'];         $varnumbath=$row['numbath'];         $varprice=$row['price'];         $varemail=$row['email'];         $varphone=$row['phone'];         $varutilities=$row['utilities'];         $vartermlease=$row['termlease'];         $varnotes=$row['notes'];         $image1=$row['imagename1'];         $image2=$row['imagename2'];         $image3=$row['imagename3'];         $image4=$row['imagename4'];          } } 

if link using fetching last record in database table, underlying query used must fetching last record instead of intended record. correct in understanding problem having? link use returning last record in database?

posting code snippet community take closer look.

in php file, run query records, ...

$record_id = mysql_real_escape_string($_get["record_id"]); $query="select * propertyinfo id=$record_id"; 

your link needs attach parameter allow query specific record.

a href="outputtest.php&record_id=8" 

and want check in parameter before sticking query! know mysql_real_escape_string outdated.


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -