empty array?
Posted: Sun May 02, 2010 6:27 pm
I've been trying to find the answer by searching the web but i keep coming up empty handed.... i have entries in a database that i'm trying to echo onto my site but the empty fields are being echoed as well... here is my code
There are some "egg" entries and "hatch" entries in the database that are empty and i don't want those printed out....
see ex. here
http://www.thehatchingdragons.com/stafftest.php
Thanks (:
Code: Select all
<?php
mysql_connect("localhost","","");
mysql_select_db("");
if(!isset($cmd))
{
$result = mysql_query("select * from dragons order by id");
while($r=mysql_fetch_array($result))
{
$egg=$r["egg"];
$hatch=$r["hatch"];
$id=$r["id"];
echo "<img src='http://dragcave.net/image/$egg.gif'>";
echo "<a href='stafftest.php?cmd=delete&id=$id'>$egg <font color='red'>x</a>";
echo "<br>";
echo "<img src='http://dragcave.net/image/$hatch.gif'>";
echo "<a href='stafftest.php?cmd=delete&id=$id'>$hatch <font color='red'>x</a>";
echo "<br>";
}
}
?>see ex. here
http://www.thehatchingdragons.com/stafftest.php
Thanks (: