I created a php page to call my members list table from mysql database. There are 2 rows; email and icq that are automatically linked to whatever shows as the result of the query. Because all members have to provide an e-mail address, it was relatively easy to insert a mailto link for the row "email". However, not all members have icq and I can't figure how to write the icq link won't show if the row icq is empty 😕
Here's the code:
<?php
$db = mysql_connect ("removed", "removed", "removed");
mysql_select_db("mannylsc_mannyleague",$db);
$result = mysql_query("SELECT * FROM LPlayers ORDER BY `player` ASC LIMIT 0, 30",$db);
$returned=mysql_num_rows($result);
echo("<a href=\"http://www.mannyls.com/lot.htm\"><img src=\"images/lot_banner_players.jpg\" border=0></a>\n");
/* Lets fetch them and display them in a table */
if ($returned>0)
{
echo("<b>$returned players<br /></b>\n");
echo("<center><a href=\"#\" onClick=\"MM_openBrWindow('gmthelp.htm','','screenX=0,left=0,screenY=0, top=0, scrollbars=yes,width=650')\"> <b>About GMT</b></a></center>");
echo ("<table width=600 bgcolor=#292929 align=\"left\" cellpadding=1 cellspacing=2>");
echo ("<tr><th class=TableHeader>Player</th><th class=TableHeader>Name</th><th class=TableHeader>Nickname</th><th class=TableHeader>Email</th><th class=TableHeader>Country</th><th class=TableHeader>gmt</th><th class=TableHeader>icq</th><th class=TableHeader>other</th><th class=TableHeader>swing</th></tr>\n");
// the first missing tag
}
// This gets every returned row, and puts each in a hash
while($row=mysql_fetch_array($result))
{
echo("<tr>");
echo("<td class=TableBody>".$row["player"]."</td>");
echo("<td class=TableBody>".$row["name"]."</td>");
echo("<td class=TableBody>".$row["nickname"]."</td>");
echo("<td class=TableBody><a href=mailto:".$row["email"].">email</a></td>");
echo("<td class=TableBody>".$row["country"]."</td>");
echo("<td class=TableBody>".$row["gmt"]."</td>");
echo("<td class=TableBody><a href='http://wwp.icq.com/scripts/Search.dll?to=".$row["icq"]."'>icq</a></td>");
echo("<td class=TableBody>".$row["other"]."</td>");
echo("<td class=TableBody>".$row["swing"]."</td>");
// the second missing tag
}?>
I'm new with PHP as my question shows :rolleyes: