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
}

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.