Re: Addin hyperlinks from an mysql_query
| From: | Chris Lee | Date: | Thu, 16 Nov 2000 04:57:37 +0000 |
| Subject: | Re: Addin hyperlinks from an mysql_query | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-25785@lists.php.net to get a copy of this message | ||
<?
$result = mysql_db_query("store_db", "SELECT * FROM clans");
while ( $r = mysql_fetch_array($result) )
{
echo "<tr>\n";
echo "<td>Name {$r["name"]} </td>\n";
echo "<td>URL <a href='http://{$r["url"]}'>Link</a>
</td>\n";
echo "<td>Email <a href='mailto:{$r["email"]}'>Email</a>
</td>\n";
echo "</tr>\n";
}
?>
This should work better.
more info at
http://www.php.net/manual/function.mysql-db-query.php
http://www.php.net/manual/function.mysql-fetch-array.php
Chris Lee
Mediawaveonline.com
In article <8v1gig$klj$1@toye.p.sourceforge.net>, scottyj1@home.com
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"È}
åCÐ ã:ÂáE
> )/">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.
>
>
>