[thelist] checking for empty vars in PHP
mort
manuel at netbustion.com
Fri Jan 3 11:06:01 CST 2003
El vie, 03-01-2003 a las 17:58, Tom Dell'Aringa escribió:
> I have this result set I am looping through. If there is nothing in
> the set, I want to print out an message. Here is the code:
> --------------------------
> while($row = mysql_fetch_array($result))
> {
> $prodname = $row["prodName"];
> $prodprice = $row["prodPrice"];
> $pid = $row["pid"];
> $photo = $row["photo"];
>
> if(!isset($prodname))
> {
> print "registry is empty.";
> }
> //display stuff
> }
> --------------------------
>
isset() certainly won't work here because you're setting $prodname =
$row["prodName"]
if ($prodname==""){print "registry is empty.";}
should work
Debug by echoing $prodname in every condition, that should clarify
everything
--
Un saludo
___________
mort
manuel en netbustion.com , logica en simplelogica.net
http://simplelogica.net <= Simplelógica, creación web
More information about the thelist
mailing list