y has something in
the $place.
-Original Message-
From: Mike At Spy [mailto:[EMAIL PROTECTED]
Sent: Tuesday, July 29, 2003 9:25 PM
To: Jay Blanchard; Mike At Spy; [EMAIL PROTECTED]
Subject: RE: [PHP] Bizarre SQl, if issue
> [snip]
> > $person = mysql_query("The Query"
Hello,
This is a reply to an e-mail that you wrote on Tue, 29 Jul 2003 at
19:59, lines prefixed by '>' were originally written by you.
> Actually, what you see is *exactly* the code being used. Nothing
has
> changed
> about it.
No. It is not the code you are using.
if ($vthere == 0) { True } els
[snip]
But that is my point - and I think we are going in circles now. It just
doesn't do that. It returns 4 (as per your example). :\
[/snip]
Then something else is wrong Mikevery, very wrong.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
* Thus wrote Mike At Spy ([EMAIL PROTECTED]):
Hey mike,
>
> > > $vthere = mysql_num_rows($which_person);
> > > if ($vthere == '0') { True } else { False }
>
> Actually, what you see is *exactly* the code being used. Nothing has changed
> about it. And whether the variable is
> [snip]
> > $person = mysql_query("The Query");
> > $thecount = mysql_num_rows($person);
> > echo "$thecount \n";
> >
> > And tell us what $thecount is...
>
> Returns 0 (zero).
> [/snip]
>
> Then
> if($thecount == 0){
>$whatever = 1;
> } else {
>$whatever = 4;
> }
>
> $whatever should be
[snip]
> $person = mysql_query("The Query");
> $thecount = mysql_num_rows($person);
> echo "$thecount \n";
>
> And tell us what $thecount is...
Returns 0 (zero).
[/snip]
Then
if($thecount == 0){
$whatever = 1;
} else {
$whatever = 4;
}
$whatever should be 1
--
PHP General Mailing List (
Returns 0 (zero).
-Mike
> -Original Message-
> From: Jay Blanchard [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, July 29, 2003 3:05 PM
> To: Mike At Spy; [EMAIL PROTECTED]
> Subject: RE: [PHP] Bizarre SQl, if issue
>
>
> [snip]
> And when I plug values int
[snip]
And when I plug values into the query at command line - values that
would
return an empty set, it executes and returns an empty set.
[/snip]
If the query is returning an empty set the value of
mysql_num_rows($person) == 0
so
$person = mysql_query("The Query");
$thecount = mysql_num_rows($
--- Mike At Spy <[EMAIL PROTECTED]> wrote:
> And when I plug values into the query at command line - values
> that would return an empty set, it executes and returns an empty
> set.
And your conditional statement agrees that the result set is empty, right? I
don't understand what the issue is now.
> Actually, what you see is *exactly* the code being used. Nothing
> has changed
> about it. And whether the variable is regarded as a string or a
> number, it
> gives me the same stupid issue. Not recognizing it as a True
> statement. :\
>
> Is there any way possible that this could be the clien
> [snip]
> if ($vthere == '0') { True } else { False }
>
>
>
> > if ($vthere == 0) { True } else { False }
>
>
> Same result (actually, that was the first statement I tried). :\
> [/snip]
>
> Then the query is failing.
But the query returns no errors - both on my code I use to test errors a
> 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($whic
[snip]
if ($vthere == '0') { True } else { False }
> if ($vthere == 0) { True } else { False }
Same result (actually, that was the first statement I tried). :\
[/snip]
Then the query is failing.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.ne
* Thus wrote Ford, Mike [LSS] ([EMAIL PROTECTED]):
> > -Original Message-
> > From: Mike At Spy [mailto:[EMAIL PROTECTED]
> > Sent: 29 July 2003 19:01
> >
> > Off hand, I would agree. And that is what I would expect.
> >
> > However, the *exact* same setup on a different se
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_per
> -Original Message-
> From: Jay Blanchard [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, July 29, 2003 2:48 PM
> To: Mike At Spy; [EMAIL PROTECTED]
> Subject: RE: [PHP] Bizarre SQl, if issue
>
>
> [snip]
> I did! Look at this again:
>
> $which_per
* Thus wrote Mike At Spy ([EMAIL PROTECTED]):
>
> Off hand, I would agree. And that is what I would expect.
>
> However, the *exact* same setup on a different server gives me a result of
> 'FALSE' properly. The other server has php 4.3.3 on it - the one giving the
> improper response has php 4.
I can't follow this thread very well, but I think the question has already been
answered.
In short, the code you originally sent us demonstrated a misunderstanding about
what mysql_query() returns. That function will return false if there is some
problem when trying to execute your query, and this
[snip]
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 el
> -Original Message-
> From: Jay Blanchard [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, July 29, 2003 2:41 PM
> To: Mike At Spy; [EMAIL PROTECTED]
> Subject: RE: [PHP] Bizarre SQl, if issue
>
>
> [snip]
> > I still want to know what you need to do, test fo
[snip]
> I still want to know what you need to do, test for query execution or
> value? It is pretty cut and dried after that.
Value. If there is nothing found in the table that matches, do one
thing.
If there is, do another. :)
[/snip]
Then you must test for something returned, not whether or
>
> [snip]
> Nothin' wrong with the SQL statement - it executes properly when I enter
> values that actually pull something from a table. When I enter values
> that
> are not present in the table, I go on to have the other issue of it
> looking
> like it is false, though it is not. :\
> [/snip]
Hello,
This is a reply to an e-mail that you wrote on Tue, 29 Jul 2003 at
18:57, lines prefixed by '>' were originally written by you.
> Off hand, I would agree. And that is what I would expect.
> However, the *exact* same setup on a different server gives me a
> result of
> 'FALSE' properly. Th
[snip]
Nothin' wrong with the SQL statement - it executes properly when I enter
values that actually pull something from a table. When I enter values
that
are not present in the table, I go on to have the other issue of it
looking
like it is false, though it is not. :\
[/snip]
But you are testin
Original Message-
> From: Jay Blanchard [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, July 29, 2003 2:24 PM
> To: Mike At Spy; Ford, Mike [LSS]; [EMAIL PROTECTED]
> Subject: RE: [PHP] Bizarre SQl, if issue
>
>
> [snip]
> I did the var_dump and got:
>
> bool(false)
&g
[snip]
I did the var_dump and got:
bool(false)
While $vthere (from my previous post) returns 0 (zero) still. :\
But proceeds as if 0 were a false statement when asked if $vthere equals
zero. :\
-Mike
[/snip]
Is the query executing properly? Try this ...
$sql = "SELECT ID from tblItems WHERE
[snip]
$which_person = mysql_query("SELECT ID FROM tblItems WHERE number =
$place");
$vthere = mysql_num_rows($which_person);
if ($vthere == '0') { True } else { False }
What should this return? True or False?
[/snip]
If there is one or more rows returned by the
: Tuesday, July 29, 2003 2:07 PM
> To: 'Mike At Spy'; Ford, Mike [LSS]; [EMAIL PROTECTED]
> Subject: RE: [PHP] Bizarre SQl, if issue
>
>
> > -Original Message-
> > From: Mike At Spy [mailto:[EMAIL PROTECTED]
> > Sent: 29 July 2003 19:01
> >
> [snip]
> Off hand, I would agree. And that is what I would expect.
>
> However, the *exact* same setup on a different server gives me a result
> of
> 'FALSE' properly. The other server has php 4.3.3 on it - the one giving
> the
> improper response has php 4.1.2.
$which_person = mysql_query
> -Original Message-
> From: Mike At Spy [mailto:[EMAIL PROTECTED]
> Sent: 29 July 2003 19:01
>
> Off hand, I would agree. And that is what I would expect.
>
> However, the *exact* same setup on a different server gives
> me a result of
> 'FALSE' properly. The other server has php 4.3.
[snip]
Off hand, I would agree. And that is what I would expect.
However, the *exact* same setup on a different server gives me a result
of
'FALSE' properly. The other server has php 4.3.3 on it - the one giving
the
improper response has php 4.1.2.
Could this be the issue?
[/snip]
It sounds un
-Original Message-
> From: Ford, Mike [LSS] [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, July 29, 2003 1:47 PM
> To: 'Mike At Spy'; [EMAIL PROTECTED]
> Subject: RE: [PHP] Bizarre SQl, if issue
>
>
> > -Original Message-
> > From: Mike At Spy [
[snip]
I know. I first tested for !$person but got the TRUE result when I
should
have received FALSE (empty set).
Why would that be?
I added '0' and such just to see if I wasn't thinking straight. :\
-Mike
[/snip]
If the query executes it will return TRUE for $person, so
if(!$person) woul
AIL PROTECTED]
> Sent: Tuesday, July 29, 2003 1:44 PM
> To: Jay Blanchard; Mike At Spy; [EMAIL PROTECTED]
> Subject: RE: [PHP] Bizarre SQl, if issue
>
>
> [snip]
>
> ...lots of stuff...
>
> [/snip]
>
> What I forgot to say is that basically you were testing fo
> -Original Message-
> From: Mike At Spy [mailto:[EMAIL PROTECTED]
> Sent: 29 July 2003 18:37
> >
> > $person = mysql_query("Some Statement Here");
Please go back and read the manual page for mysql_query again
(http://www.php.net/mysql_query).
The above returns FALSE if the query is in
Hello,
This is a reply to an e-mail that you wrote on Tue, 29 Jul 2003 at
18:25, lines prefixed by '>' were originally written by you.
> If the SQL statement returns an empty set, shouldn't $result be
equal
> to 1?
> Instead, I'm getting $result = 4.
If the query fails, e.g. because you have an e
[snip]
...lots of stuff...
[/snip]
What I forgot to say is that basically you were testing for query
execution, not the number of rows returned from the database. If you
want to test the number of rows or some other result from the query you
have to go further.
HTH!
--
PHP General Mailing List
[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 =
ke At Spy; [EMAIL PROTECTED]
> Subject: RE: [PHP] Bizarre SQl, if issue
>
>
> [snip]
> $person = mysql_query("Some Statement Here");
>
> if (!$person || $person == 0 || $person == '' || $person == '0') {
> $result =
> 1; }
> else { $resul
[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 n
Did you try to print the content of the variable?
What does it contain?
On Tue, 29 Jul 2003 13:29:10 -0400
"Mike At Spy" <[EMAIL PROTECTED]> wrote:
>
> Hey, I've got a weird issue. I have some code, an MySQL statement, that
> returns an empty set, like this:
>
> $person = mysql_query("Some S
Hey, I've got a weird issue. I have some code, an MySQL statement, that
returns an empty set, like this:
$person = mysql_query("Some Statement Here");
So, then I have an if/else statement:
if (!$person || $person == 0 || $person == '' || $person == '0') { $result =
1; }
else { $result = 4; }
42 matches
Mail list logo