Hello!
I have a set up a details page from a search results page. Basically the query results allow a field to be clickable allowing the person to get more info on the desired record. The problem is that I can't get the details page to pull up more info on the desired record.
I have posted code from the results page and the details page below. But basically I have it set as:
echo "<a href = details.php?ID=$ID>Report Number</a>";
is the clickable field on the results page that goes to a query to this details page:
$query="SELECT * FROM pubsonweb WHERE ID=\"$ID\"";
If I change $ID to a numeric value (eg 2), the record with the primary key (ID) of 2 will appear. Therefore I think that the $ID is not getting passed from the results page to the details page....Any suggestions will be greatly appreciated!
//Results page:
$result = mysql_query($query);
$num_results = mysql_num_rows($result);
echo "<p>Number of matching results: ".$num_results."</p>";
for ($i=0; $i <$num_results; $i++)
{
$row = mysql_fetch_array($result);
echo "<a href = details.php?ID=$ID>Report Number</a>";
echo htmlspecialchars ( stripslashes($row["rptid"]));
echo "</strong><br>Author: ";
echo htmlspecialchars ( stripslashes($row["author"]));
echo "</strong><br>Title: ";
echo htmlspecialchars ( stripslashes($row["title"]));
echo "<br>Source: ";
echo htmlspecialchars ( stripslashes($row["source"]));
echo "<p>";
}
//Details page:
mysql_select_db("jem21466_publications");
$query="SELECT * FROM pubsonweb WHERE ID=\"$ID\"";
$result=mysql_query($query);
while ($row=mysql_fetch_array($result))
{
$ID=$row['ID'];
$rptid=$row['rptid'];
$title=$row['title'];
echo $ID;
echo $rptid;
echo $title;
}
mysql_close();
Thanks!!