Jump to content

Recommended Posts

First of all, use elseif on the second one.  Secondly, are you using == or =?  That's a common problem.

In his code it doesn't really matter either way.  Either ==0 will work or it won't. Either ==1 will work or it won't.  Both will be evaluated just the same.  He could even use a switch statement here.  Or if the value will only be 0 or 1, he could just do an if...else.

 

As far as the problem goes, obviously $row['status'] is either 0 or false.  More likely it is false.  You need to go up and check where you're assigning that value.  It could be any number of things.  I'm going to assume the you're getting it from a sql query, based on $row being a common variable people like to use for assigning query results.

 

-perhaps your mysql_connect failed

-- use the right connection info?

-perhaps your mysql_select_db failed

-- use the right db name?

-perhaps your mysql_query failed

-- did you echo your query string to see if you're sending what you expect to the db?

-perhaps you used the wrong column name

-- perhaps you did not properly fetch the results

 

In short:

 

Post more code and elaborate on the problem please. What's given is hardly helpful.

 

I think I'd start out by adding

...or trigger_error("SQL", E_USER_ERROR);

 

after all your db function calls.

Link to comment
https://forums.phpfreaks.com/topic/111281-if/#findComment-571241
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.