[thelist] checking for empty vars in PHP

Tom Dell'Aringa pixelmech at yahoo.com
Fri Jan 3 10:59:01 CST 2003


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
}
--------------------------

I am not getting the print statement at all with this, even though
$prodname is blank or empty. I have tried

if($prodname == "") and if(!$prodname) but these didn't work for me.
Am I testing the wrong thing? $prodname certainly is = "" so I am
totally confused!

Tom

=====
var me = tom.pixelmech.webDeveloper();

http://www.pixelmech.com/
http://www.maccaws.com/
[Making A Commercial Case for Adopting Web Standards]

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com



More information about the thelist mailing list