I have a code that retrieves data from database. I need to show detailed information of clicked object on another page according to the id of the object. How can I achieve this? When I set $_SESSION and use in another page it takes only last value. Codes retrieves info is as following.
<?php
include("misc.inc");
session_start();
$connect = mysqli_connect($host,$user,$password,$database) or die ("Couldn't connect database");
$sql = "SELECT * FROM ad ORDER BY training_start desc";
$result = mysqli_query($connect,$sql) or die("Couldn't execute query.");
echo "<table cols='4' cellspacing='25'>";
echo "<th>ID</th>";
echo "<th>Training Name</th>";
echo "<th>Trainer Name</th>";
echo "<th>Training Dates</th>";
echo "<th>Registration Starts</th>";
while($row=mysqli_fetch_assoc($result))
{
extract($row );
echo "<tr><td >$id</td>";
echo "<td ><a href='ad_details.php'>$training_name</a></td>";
echo "<td >$trainer_name</td>";
echo "<td >$training_start - $training_end</td>";
echo "<td >$reg_start</td></tr>";
}
echo "</table>";
?>