Page 1 of 1

Help with if staement

Posted: Sat Apr 04, 2009 6:58 pm
by grozanc
Hello,

I have a field in a MySQL table that defaults to "empty" unless it's written over. I'm using the following code to assign a variable based on what's written in that MySQL field.

Code: Select all

 
$query2  = "SELECT * FROM $table";
$row = mysql_fetch_assoc(mysql_query($query2));
if ($row['name'] == 'empty') { $joblink = "no download"; } else { $joblink = "download"; }; 
 
However, it doesn't seem to recognize the if statement and defaults to else part of the if statement regardless of what actually in the filed. Any ideas?

Thanks,
Gary

Re: Help with if staement

Posted: Sat Apr 04, 2009 7:08 pm
by Chris Corbyn
What does:

Code: Select all

var_dump($row);
show?

Re: Help with if staement

Posted: Sat Apr 04, 2009 7:17 pm
by grozanc
Thanks for the help!

Since I'm still new, I'm guessing you wanted me to

Code: Select all

echo "var_dump($row)";
and see the results of what's actually in each table filed.

If I was right in my guess, the following was the result, "var_dump(Array)"

If you needed me to do something different, could you give me a little more specific directions?

Thanks,
Gary