Mike
10-15-2003, 09:50 AM
Hi all,
Using PHP, I would like to create a similar linking system to the one used on this site. So each link is entered into a database, given an id, and linked to like "out.php?id=4" or something.
I haven't used MySQL for ages, so I'm not completely sure how to do it. I think it would involve a for statement with mysql_num_rows, something like:
$result = mysql_query("SELECT * FROM table", $dbcnx) ;
for ($x= 0; $x < mysql_num_rows($result); $x++)
{
$row = mysql_fetch_assoc($result) ;
echo ("<a href=\"out.php?id=") ;
echo ($row['ID']) ;
echo ("\">") ;
As I said, it's a long time since I last used MySQL and PHP together, so chances are that's probably wrong.
Please could anyone give me any advice on an easier way or anything?
Thanks a lot,
Mike
Using PHP, I would like to create a similar linking system to the one used on this site. So each link is entered into a database, given an id, and linked to like "out.php?id=4" or something.
I haven't used MySQL for ages, so I'm not completely sure how to do it. I think it would involve a for statement with mysql_num_rows, something like:
$result = mysql_query("SELECT * FROM table", $dbcnx) ;
for ($x= 0; $x < mysql_num_rows($result); $x++)
{
$row = mysql_fetch_assoc($result) ;
echo ("<a href=\"out.php?id=") ;
echo ($row['ID']) ;
echo ("\">") ;
As I said, it's a long time since I last used MySQL and PHP together, so chances are that's probably wrong.
Please could anyone give me any advice on an easier way or anything?
Thanks a lot,
Mike