Note that there are some explanatory texts on larger screens.

plurals
  1. POClick able search with ID
    primarykey
    data
    text
    <p>Help I have a search with a clickable link which sends you to another page to view full results, But cant seem to get the ID into /searchclick.php?id=</p> <p>Code for search</p> <pre><code> // Build SQL Query $query = "SELECT Bird_ID, Species from Birds where Species like \"%$trimmed%\" order by Species"; $numresults=mysqli_query($conn, $query); $numrows=mysqli_num_rows($numresults); if ($numrows == 0) { echo "&lt;h4&gt;Results&lt;/h4&gt;"; echo "&lt;p&gt;Sorry, your search: " . $trimmed . " returned zero results&lt;/p&gt;"; } // next determine if s has been passed to script, if not use 0 if (empty($s)) { $s=0; } // get results $query .= " limit $s,$limit"; $result = mysqli_query($conn, $query) or die("Couldn't execute query"); echo "&lt;br /&gt;"; // display what the person searched for echo "&lt;br /&gt;"; echo "&lt;p&gt;You searched for: &amp;quot;" . $var . "&amp;quot;&lt;/p&gt;"; // begin to show results set echo "&lt;br /&gt;"; echo "&lt;br /&gt;"; echo "Results"; echo "&lt;br /&gt;"; $count = 1 + $s ; // now you can display the results returned echo "&lt;center&gt;"; echo '&lt;table cellpadding="1" cellspacing="1" border="1"&gt;'; echo '&lt;tr&gt;&lt;th&gt;Bird_ID&lt;/th&gt;&lt;th&gt;Species&lt;/th&gt;&lt;th&gt;Comments&lt;/th&gt;&lt;/tr&gt;'; while ($row= mysqli_fetch_array($result)) { echo "&lt;tr&gt;"; echo '&lt;td&gt;&lt;a href="searchclick.php?id="&gt;'.$row['Bird_ID'].'&lt;/a&gt;&lt;/td&gt;'; echo '&lt;td&gt;'.$row['Species'].'&lt;/a&gt;&lt;/td&gt;'; echo '&lt;td&gt;'.$row['Comments'].'&lt;/a&gt;&lt;/td&gt;'; $count++ ; } </code></pre> <p>The code for the clicked results</p> <pre><code> session_start(); include '/home/wc002/include/dbconnect.php'; // get value of id that sent from address bar $id = $_GET['id']; // Retrieve data from database $query = "SELECT Bird_ID, Species, Comments, Image FROM Birds WHERE Bird_ID = '$id'"; echo "&lt;br /&gt;"; echo '&lt;table cellpadding="1" cellspacing="1" border="1" width="100"&gt;'; echo '&lt;tr&gt;&lt;th&gt;Bird ID&lt;/th&gt;&lt;th&gt; Species &lt;/th&gt;&lt;/tr&gt;'; $result = mysqli_query($conn, $query) or die(mysqli_error()); while($row = mysqli_fetch_array($result)){ echo "&lt;tr&gt;"; echo "&lt;td&gt;" . $row['Bird_ID'] . "&lt;/td&gt;"; echo "&lt;td&gt;" . $row['Species'] . "&lt;/td&gt;"; echo "&lt;td&gt;" . $row['Comments'] . "&lt;/td&gt;"; echo "&lt;td&gt;" . $row['Image'] . "&lt;/td&gt;"; echo "&lt;/td&gt;"; } ?&gt; </code></pre> <p>Thank you in advances</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload