RE: [PHP] Bizarre SQl, if issue....

2003-07-29 Thread Petre Agenbag
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"

Re: [PHP] Bizarre SQl, if issue....

2003-07-29 Thread David Nicholson
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

RE: [PHP] Bizarre SQl, if issue....

2003-07-29 Thread Jay Blanchard
[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

Re: [PHP] Bizarre SQl, if issue....

2003-07-29 Thread Curt Zirzow
* 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

RE: [PHP] Bizarre SQl, if issue....

2003-07-29 Thread Mike At Spy
> [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

RE: [PHP] Bizarre SQl, if issue....

2003-07-29 Thread Jay Blanchard
[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 (

RE: [PHP] Bizarre SQl, if issue....

2003-07-29 Thread Mike At Spy
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

RE: [PHP] Bizarre SQl, if issue....

2003-07-29 Thread Jay Blanchard
[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($

RE: [PHP] Bizarre SQl, if issue....

2003-07-29 Thread Chris Shiflett
--- 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.

RE: [PHP] Bizarre SQl, if issue....

2003-07-29 Thread Jennifer Goodie
> 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

RE: [PHP] Bizarre SQl, if issue....

2003-07-29 Thread Mike At Spy
> [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

RE: [PHP] Bizarre SQl, if issue....

2003-07-29 Thread Mike At Spy
> 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

RE: [PHP] Bizarre SQl, if issue....

2003-07-29 Thread Jay Blanchard
[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

Re: [PHP] Bizarre SQl, if issue....

2003-07-29 Thread Curt Zirzow
* 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

Re: [PHP] Bizarre SQl, if issue....

2003-07-29 Thread David Nicholson
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

RE: [PHP] Bizarre SQl, if issue....

2003-07-29 Thread Mike At Spy
> -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

Re: [PHP] Bizarre SQl, if issue....

2003-07-29 Thread Curt Zirzow
* 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.

RE: [PHP] Bizarre SQl, if issue....

2003-07-29 Thread Chris Shiflett
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

RE: [PHP] Bizarre SQl, if issue....

2003-07-29 Thread Jay Blanchard
[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

RE: [PHP] Bizarre SQl, if issue....

2003-07-29 Thread Mike At Spy
> -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

RE: [PHP] Bizarre SQl, if issue....

2003-07-29 Thread Jay Blanchard
[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

RE: [PHP] Bizarre SQl, if issue....

2003-07-29 Thread Mike At Spy
> > [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]

Re: [PHP] Bizarre SQl, if issue....

2003-07-29 Thread David Nicholson
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

RE: [PHP] Bizarre SQl, if issue....

2003-07-29 Thread Jay Blanchard
[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

RE: [PHP] Bizarre SQl, if issue....

2003-07-29 Thread Mike At Spy
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

RE: [PHP] Bizarre SQl, if issue....

2003-07-29 Thread Jay Blanchard
[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

RE: [PHP] Bizarre SQl, if issue....

2003-07-29 Thread Jay Blanchard
[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

RE: [PHP] Bizarre SQl, if issue....

2003-07-29 Thread Mike At Spy
: 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 > >

RE: [PHP] Bizarre SQl, if issue....

2003-07-29 Thread Mike At Spy
> [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

RE: [PHP] Bizarre SQl, if issue....

2003-07-29 Thread Ford, Mike [LSS]
> -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.

RE: [PHP] Bizarre SQl, if issue....

2003-07-29 Thread Jay Blanchard
[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

RE: [PHP] Bizarre SQl, if issue....

2003-07-29 Thread Mike At Spy
-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 [

RE: [PHP] Bizarre SQl, if issue....

2003-07-29 Thread Jay Blanchard
[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

RE: [PHP] Bizarre SQl, if issue....

2003-07-29 Thread Mike At Spy
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

RE: [PHP] Bizarre SQl, if issue....

2003-07-29 Thread Ford, Mike [LSS]
> -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

Re: [PHP] Bizarre SQl, if issue....

2003-07-29 Thread David Nicholson
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

RE: [PHP] Bizarre SQl, if issue....

2003-07-29 Thread Jay Blanchard
[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

RE: [PHP] Bizarre SQl, if issue....

2003-07-29 Thread Jay Blanchard
[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 =

RE: [PHP] Bizarre SQl, if issue....

2003-07-29 Thread Mike At Spy
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

RE: [PHP] Bizarre SQl, if issue....

2003-07-29 Thread Jay Blanchard
[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

Re: [PHP] Bizarre SQl, if issue....

2003-07-29 Thread Lucas Lain
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

[PHP] Bizarre SQl, if issue....

2003-07-29 Thread Mike At Spy
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; }