[snip]
Here's the SQL - I tested it via command line and it comes back empty
set.

SELECT ID FROM tblItems WHERE number = $place
> 
> [snip]
> $person = mysql_query("Some Statement Here");
> 
> if (!$person || $person == 0 || $person == '' || $person == '0') {
> $result =
> 1; }
> else { $result = 4; }
> 
> If the SQL statement returns an empty set, shouldn't $result be equal
to
> 1?
> Instead, I'm getting $result = 4.
> [/snip]
> 
> Actually I think we need to see the query == "Some Statement Here".
> $person in this case is either TRUE or FALSE
[snip]

So ...
$person = mysql_query("SELECT ID FROM tblItems WHERE number = $place");
$person IS TRUE because query executed (the OR statements do not count
as $person can only be TRUE or FALSE, so you can drop the OR's);

if(!$person){ // tests to see if person IS FALSE
   $result = 1;
} else {
   $result = 4;
}

$result will be 4

If you do this;
if($person){ // tests to see if person IS TRUE
   $result = 1;
} else {
   $result = 4;
}

$result would be 1

Now, if you used mysql_num_rows($person)

$thecount = mysql_num_rows($person);

if($thecount == 0){ // tests for zero
   $result = 1;
} else {
   $result = 4;
}

$result will be 1

if(!$thecount == 0){ // tests for other than zero
   $result = 1;
} else {
   $result = 4;
}

$result will be 4

HTH

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to