I would like to display only a selected result on my php page.
This is my php code:
$bookdetsql = "
SELECT b.bookISBN
, b.bookTitle
, b.bookYear
, b.catID
, b.pubID
, p.pubName
, p.location
, c.catDesc
, b.bookPrice
FROM nbc_book b
LEFT
JOIN nbc_category c
ON b.catID = c.catID
LEFT
JOIN nbc_publisher p
ON b.pubID = p.pubID
";
$bookdetrs = mysqli_query($conn, $bookdetsql) or die(mysqli_error($conn));
$bookdetnum = mysqli_num_rows($bookdetrs);
if($bookdetnum >= 1 ){
echo "<div style='margin: 0 0 10px 0; font-weight: bold;'>$bookdetnum record(s) found!</div>";
while ($row = mysqli_fetch_assoc($bookdetrs)) {
echo "<tr>";
echo "<td><center>" . $row['bookTitle']."</a></center></td>";
echo "<td><center>" . $row['bookYear']."</center></td>";
echo "<td><center>" . $row['catDesc']."</center></td>";
echo "<td><center>" . $row['bookPrice']."</center></td>";
echo "<td><center>" . $row['pubName']."</center></td>";
echo "<td><center>" . $row['location']."</center></td>";
echo "</tr>";
}
} else {
echo "<b>Books not found!</b>";
}
Actually this code above is displaying the whole list of records actually. I only want it to display selected record which i clicked on my first php page.
How did you get the values frmo the first page? GET or POST?
when you have the value(s), you can add an where clause to your SELECT Statement