Help with if staement

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
grozanc
Forum Newbie
Posts: 14
Joined: Tue Oct 23, 2007 6:50 pm

Help with if staement

Post 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
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: Help with if staement

Post by Chris Corbyn »

What does:

Code: Select all

var_dump($row);
show?
grozanc
Forum Newbie
Posts: 14
Joined: Tue Oct 23, 2007 6:50 pm

Re: Help with if staement

Post 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
Post Reply