Hi,
I have set up a HTML table which iterates a news row as long as there is another result from a query ran on the databse using a while loop. The query that creates this searches the table and produces the records where the search terms are met.
The primary key is stored as a session, and appends to the end of the URL when a link in the table is clicked. When hovering over the link, I can see that the URL is correctly set up with the ID.
However, when the link is clicked, the value in the session changes to the primary key of the LAST record on the table that was being viewed, and not the one that is being clicked, which means the database is not correctly being updated when queries on this new page are being run.
The code for creating the tables is as follows:
<tr bgcolor="<?php echo $color ?>">
<td><?php echo $row['author'] ?></td>
<td><?php echo $row['title'] ?></td>
<?php
$_SESSION['subject']="?".urlencode('subj')."=".urlencode($_SESSION['searchb']);
?>
<td><?php
if ($row['availability'] == "0"){?>
<strike><font color="#AAAAAA">Reserve</font></strike>
<?php }
else{?><a href="reserve.php<?php
$book = $row['pkey'];
$_SESSION['data'] = $book;
$reserveStr=$_SESSION['subject']."+".urlencode('bookID')."=".$_SESSION['data'];
echo $reserveStr; ?>">Reserve</a><?php }
?></td>
</tr>
<tr bgcolor="<?php echo $color ?>">
<td colspan="3"><?php echo $row['description'] ?></td>
</tr>
Any help fixing this issue would be greatly appreciated if possible