Re: Bizarre SQl, if issue....
| From: | David Nicholson | Date: | Tue, 29 Jul 2003 18:52:03 +0000 |
| Subject: | Re: Bizarre SQl, if issue.... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-157387@lists.php.net to get a copy of this message | ||
Hello,
This is a reply to an e-mail that you wrote on Tue, 29 Jul 2003 at
19:46, lines prefixed by '>' were originally written by you.
> I did! Look at this again:
> $which_person = mysql_query("SELECT ID FROM tblItems WHERE
number =
> $place");
> $vthere = mysql_num_rows($which_person);
> if ($vthere == '0') { True } else { False }
> Yet it still returns as if this is FALSE (i.e. it executes the
else
> {}. :
As long as your query is returning 0 rows that code should work ok,
but it is incorrect for correctness,
if ($vthere == '0')
should be
if ($vthere == 0)
As $vthere will contain an integer, not a string, but as you are
using the == comparison operator instead of === PHP should
convert them both to the same type before comparing.
Can we see the snippet of the actual code that you are using?
David.
--
phpmachine :: The quick and easy to use service providing you with
professionally developed PHP scripts :: http://www.phpmachine.com/
Professional Web Development by David Nicholson
http://www.djnicholson.com/
QuizSender.com - How well do your friends actually know you?
http://www.quizsender.com/
(developed entirely in PHP)