Re: Addin hyperlinks from an mysql_query

From: Date: Thu, 16 Nov 2000 20:55:41 +0000
Subject: Re: Addin hyperlinks from an mysql_query
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-25784@lists.php.net to get a copy of this message
On Thu, 16 Nov 2000, Scott wrote: > I have done a complete search over this ng and have not found a similar > post, so I must ask. > > I am maintaining a list of people who have wesites and emails, an produce > the results on a web page. > > I would like however to list the emails and urls as a hyperlink selection. > I know how to do this for a normal .html page but am unsuccesful in doing it > in a .phtm page. I was trying to embed the mysql_guery into the href code > but nope. How can I do this? > > This is a very simple code that I am testing on: > > <TABLE BORDER = "1"> > > <? > mysql_connect(localhost, userid, password); > $result = mysql(designfreaks_net, "select * from Clans"); > $num = mysql_numrows($result); > $i = 0; > > while($i < $num) { > echo "<TR>"; > echo "<TD>"; > echo mysql_result($result,$i,"Name"); > echo "<TD><TD>"; > echo mysql_result($result,$i,"Tag"); > echo "<TD>"; > <a > > href="http://mysql_result($result,$i,"URL")/">http://mysql_result($result,$i > ,"URL")/</a>; > echo "<TD>"; > echo mysql_result($result,$i,"Leader"); > echo "<TD>"; > echo mysql_result($result,$i,"ICQ"); > echo "<TD>"; > echo mysql_result($result,$i,"L_Email"); > echo "<TD>"; > echo mysql_result($result,$i,"Games"); > echo "<TD>"; > echo mysql_result($result,$i,"Recruiting"); > echo "<TD>"; > echo "<TR>"; > $i++; > } > ?> > </TABLE> > > Thanks in advance for any help here and I hope I am even posting in the > right area. > Try: <table> <?php $cxn=mysql_connect(localhost, userid, password); $result=mysql_db_query("designfreaks_net", "select * from Clans", $cxn); while ($row=mysql_fetch_array($result)) { ?> <tr> <td><?=$row["Name"]?></td> <td><?=$row["Tag"]?></td> <td><a href="http://<?=$row["URL"]?>"><?=$row["URL"]?></a></td> <td><?=$row["Leader"]?></td> <td><?=$row["ICQ"]?></td> <td><?=$row["L_Email"]?></td> <td><?=$row["Games"]?></td> <td><?=$row["Recruiting"]?></td> </tr> <?php }; ?> </table> -- Ignacio Vazquez-Abrams <ignacio@openservices.net>

« previous php.general (#25784) next »