I am trying to make the results from mysql results clickable links in php. I am new to php and please help.
echo '<a href="php page which you want to display on click">$info['descr']</a>'
while ($info = mysql_fetch_array($data)) {
echo '<a href="somefile.php?id='.$info['ID'].'">'.$info['title'].'</a>';
echo " <br>";
echo $info['descr'];
echo "<br>";
echo "<br>";
}
Then in somefile.php
, use $_GET
to capture the id and show the results
$id = $_GET['id'];
// pull info from db based on $id
$sql = mysql_query('SELECT * FROM items WHERE ID = "'.$id.'"');
.
.
.
.
just use anchor tag like this
while ($info = mysql_fetch_array($data)) {
echo "<a href =\"$info[title]\">".$info['title'];. "</a>";
}