making links out of records? newbie
| From: | Nick | Date: | Tue, 15 Mar 2005 15:05:56 +0000 |
| Subject: | making links out of records? newbie | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-210783@lists.php.net to get a copy of this message | ||
Hi there, i have a page called squad.php which queries a mysql table and outputs all the squad members from by football team. This is fine, however i would like to make each returned record into a hyperlink which when clicked on displays more details about that player. I believe i need to use the $PHP_SELF command, how i do this though i do not know. Here is what i have so far:
<?php
// Connecting, selecting database
$link = mysql_connect('localhost', '', '')
or die('Could not connect: ' . mysql_error());
echo 'Connected successfully';
mysql_select_db('database') or die('Could not select database');
// Performing SQL query
$query = 'SELECT * FROM tblusers WHERE squadnum <99';
$result = mysql_query($query) or die('Query failed: ' . mysql_error());
// Printing results in HTML
echo "<table border=1>\n";
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { echo "\t<tr>\n";
foreach ($row as $col_value) {
echo "\t\t<td>$col_value</td>\n";} echo "\t</tr>\n"; } echo "</table>\n"; ?> Any help much appreciated, nick.