Jump to content

If statement problems


affordit

Recommended Posts

The IF has its own scope and can't touch any variables outside, unless you're using globals (safe type). You can do these..

 

if (mysql_query($query2)){
echo "done"; //Just echo it where needed.
}

if (mysql_query($query2)){
$GLOBALS['done'] = "done"; //Set global $done as 'done', as you wanted
}

Link to comment
Share on other sites

Errrr....  That's just wrong oni-kun.

 

 

if()

 

Inherits what ever scope it's in, but does not create it's own scope.

 

For example:

 

$x = 5;

if($x == 5) {

    $x = 6;

}

echo $x;

 

Would say "6".

 

 

 

Chances are, if done is not getting a value, it's either being unset somewhere else or the query is failing.

Link to comment
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.