A
Anonymous
Guest
Hi all,
Please I need some help here. I'm retrieving data from mysql table "bookcopy" and displaying list of books with their prices. I want users to be able to view details of any book they clicked on, on a page I called detail.php.
The list is displayed successfully, how ever, if you click any of the books, it shows the details of the first book on the list, on matter which one you select. Can anyone help me out please?
Below is the code I used. I ask this question 2weeks ago, but haven't receive any response.
Thank you.
Please I need some help here. I'm retrieving data from mysql table "bookcopy" and displaying list of books with their prices. I want users to be able to view details of any book they clicked on, on a page I called detail.php.
The list is displayed successfully, how ever, if you click any of the books, it shows the details of the first book on the list, on matter which one you select. Can anyone help me out please?
Below is the code I used. I ask this question 2weeks ago, but haven't receive any response.
Thank you.
Code:
<html>
<head>
<title>SHUBooks</title>
</head>
<body>
<?php
session_start();
include('connect.php');
$query = "SELECT * FROM bookcopy";
$result = mysql_query($query) or die(mysql_error());
?>
<div align="center"><b>Thank you for visiting SHUBooks! Please see our list of available Books below, and click to view Book
details:
</b><br><br>
<table border="1">
<?php
echo "<tr>";
echo "<td bgcolor=\"red\" width=\"30\">";
echo "<font color=\"white\"><b>";
echo "Back Cover";
echo "<font></b></td>";
echo "<td bgcolor=\"red\" with=\"50\">";
echo "<font color=\"white\"><b>";
echo "Book Title";
echo "<font></b></td>";
echo "<td bgcolor=\"red\" width=\"20\"><td>";
echo "</tr>";
//display books with prices
while($row = mysql_fetch_array($result))
{
//extract($row);
echo "<tr>";
echo "<a href=\"detail.php?bookId=".$row['bookId']."\">";
echo "<td><em>BOOK IMAGE</em></td>";
echo "<td>";
echo "<a href=\"detail.php?bookId=".$row['bookId']."\">";
echo $row['bookTitle'];
echo "</td>";
echo "<td>";
echo "<a href=\"detail.php?bookId=".$row['bookId']."\">";
echo "View Details</a>";
echo "</td>";
echo "</tr>";
}
?>
</table>
<?php
echo "<hr size=\"1\" color=\"red\" NOSHADE>";
echo "<form action=\"cart.php\">";
echo "<input type=\"submit\" value=\"My Shopping Cart >>\">";
echo "<input type=\"hidden\" name=\"bookId\" value=".$row['bookId'].">";
echo "</form>";
?>
</body>
</html>