You are here: Re: [PHP] making links out of records? newbie « PHP « IT news, forums, messages
Re: [PHP] making links out of records? newbie

Posted by Nick on 03/15/05 18:35

Thanks, that seems to work fine.


Richard Lynch wrote:

>>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";
>>
>>
>
>$id = $row['id'];
>
>
>
>> foreach ($row as $col_value) {
>>
>>
>
>echo "\t\t<td><a href=squad_member.php?id=$id>$col_value</a></td>\n";
>
>
>
>> }
>> echo "\t</tr>\n";
>>}
>>echo "</table>\n";
>>
>>?>
>>
>>Any help much appreciated, nick.
>>
>>--
>>PHP General Mailing List (http://www.php.net/)
>>To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>>
>>
>
>
>
>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация