I would like to display SQL results, each line with html link, where each link contains the table id.
My table name : fruits
table_id content description price
---------------------------------------------------
1 apple tastes good 3 usd
2 peach grows on tree 4 usd
3 plump very purple 1 usd
It should display
Fruits
apple | tastes good
peach | grows on tree
plump | very purple
(Note: I haven't fetched price at this point)
My code so far:
$result = mysql_query("SELECT table_id,content,decription FROM fruits",$conn);
echo table
while ($row = mysql_fetch_row($res)) {
echo "<tr>";
echo "<td>" . $row[0] . "</td>";
echo "<td>" . $row[1] . "</td>";
echo "<td>" . $row[2] . "</td>";
echo "</tr>";
}
echo "</table>";
What I want to achieve instead of echo :
a href="link to fetch id 1">apple | tastes good
a href="link to fetch id 2">peach | grows on tree
a href="link to fetch id 3">plump | very purple
When i mean "link to fetch id 1", i mean like href="www.application.com/another.php and some way to pass fetch id 1 or 2 or 3 to another php file.
How can i make these links ?
How can I catch the passed id in another php file ?
Thank you for your help.