Ask a Question related to PHP Development, Design and Development.
-
Curt Zirzow #21
Re: [PHP] Bizarre SQl, if issue....
* Thus wrote Mike At Spy (spycobalt@spyproductions.com):
I've never had an issue with this since php 3.01b or was that>
> 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?
3.11b.. i always get those two confused :)
Curt
--
"I used to think I was indecisive, but now I'm not so sure."
Curt Zirzow Guest
-
Fonts are there, then they're not. Bizarre.
I am using InDesign CS on a pc. I use a limited number of fonts to layout our monthly newsletter. I installed the fonts I needed and they were... -
5.80, OS X, bizarre FTP weirdness
I am running Mac OS X 10.2.7 and recently upgraded from 5.6.1 to 5.8.0 following the guidance at... -
Bizarre SQl, if issue....
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... -
Bizarre HD Problem
OS: Win98/Mandrake 9.1 I just installed a new 80GB Maxtor HD (6Y080L0) and, while my BIOS sees it and it shows up in dmesg as 'hdd', a) It... -
Bizarre IE6 CSS error
Hi all, I have the weirdest thing going on... it's hard even to describe, but bascically, IE6 seems to interpret differently the margins/padding... -
Mike At Spy #22
RE: [PHP] Bizarre SQl, if issue....
> -----Original Message-----
> From: Jay Blanchard [mailto:jay.blanchard@niicommunications.com]
> Sent: Tuesday, July 29, 2003 2:48 PM
> To: Mike At Spy; [email]php-general@lists.php.net[/email]
> Subject: RE: [PHP] Bizarre SQl, if issue....
>
>
> [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 else {}.
> :\
> [/snip]
>
> try ....
>
> if ($vthere == 0) { True } else { False }
Same result (actually, that was the first statement I tried). :\
-Mike
Mike At Spy Guest
-
Jay Blanchard #23
RE: [PHP] Bizarre SQl, if issue....
[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.
Jay Blanchard Guest
-
Mike At Spy #24
RE: [PHP] Bizarre SQl, if issue....
> 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.> number => > I did! Look at this again:
> > $which_person = mysql_query("SELECT ID FROM tblItems WHERE> else> > $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>> > {}. :
> 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?
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 client's server? I had to
beg to get 'em to recompile to 4.1.2 from 4.0.3. There are using a version
of Linux I don't recognize (it isn't redhat or mandrake), but it looks like
their kernel is up to date.
On my redhat server (with php 4.3.3), the same code responds properly (i.e.
that $vthere ==0 is true).
:\
-Mike
Mike At Spy Guest
-
Mike At Spy #25
RE: [PHP] Bizarre SQl, if issue....
But the query returns no errors - both on my code I use to test errors and> [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.
the one you sent to me! :\
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.
:)
Thanks,
-Mike
Mike At Spy Guest
-
Jay Blanchard #26
RE: [PHP] Bizarre SQl, if issue....
[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($person);
echo "$thecount \n";
And tell us what $thecount is...
Jay Blanchard Guest
-
Mike At Spy #27
RE: [PHP] Bizarre SQl, if issue....
Returns 0 (zero).
-Mike
> -----Original Message-----
> From: Jay Blanchard [mailto:jay.blanchard@niicommunications.com]
> Sent: Tuesday, July 29, 2003 3:05 PM
> To: Mike At Spy; [email]php-general@lists.php.net[/email]
> Subject: RE: [PHP] Bizarre SQl, if issue....
>
>
> [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($person);
> echo "$thecount \n";
>
> And tell us what $thecount is...
>
>Mike At Spy Guest
-
Jay Blanchard #28
RE: [PHP] Bizarre SQl, if issue....
[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 Mike....very, very wrong.
Jay Blanchard Guest
-
Mike At Spy #29
RE: [PHP] Bizarre SQl, if issue....
But that is my point - and I think we are going in circles now. It just> [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
doesn't do that. It returns 4 (as per your example). :\
-Mike
Mike At Spy Guest
-
Curt Zirzow #30
Re: [PHP] Bizarre SQl, if issue....
* Thus wrote Mike At Spy (spycobalt@spyproductions.com):
Hey mike,
Have you tried just testing the value of $vthere:>>> > > $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 regarded as a string or a number, it
> gives me the same stupid issue. Not recognizing it as a True statement. :\
if (!$vthere) { we dont have data } else { we have data }
I've been using this method since really early versions of php and
havn't had any problems with this method. Unless there was some
excplicite bug with version 4.1.2, I may have skipped that version
upgrade.
Really they should at least stay current. I would insist they>
> Is there any way possible that this could be the client's server? I had to
> beg to get 'em to recompile to 4.1.2 from 4.0.3. There are using a version
> of Linux I don't recognize (it isn't redhat or mandrake), but it looks like
> their kernel is up to date.
upgrade or remove php from their plan (argghh.)
Curt
--
"I used to think I was indecisive, but now I'm not so sure."
Curt Zirzow Guest
-
David Nicholson #31
Re: [PHP] Bizarre SQl, if issue....
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.has> Actually, what you see is *exactly* the code being used. NothingNo. It is not the code you are using.> changed
> about it.
if ($vthere == 0) { True } else { False }
would give a parse error.
I> Is there any way possible that this could be the client's server?a> had to
> beg to get 'em to recompile to 4.1.2 from 4.0.3. There are usinglooks> version
> of Linux I don't recognize (it isn't redhat or mandrake), but itIMO, if you want to find out what is wrong you need to stop looking> like
> their kernel is up to date.
for things out of your control that could be breaking it. Chances
are PHP is doing exactly as it is documented to do, no matter what
PHP version, linux distro, kernel version or anything else in use.
Follow your code through exactly as it would be when it is
interpreted and be on the lookout for your mistake, not your excuse
and you will find the error in your code!
Right now though I think everyone is very confused about your problem
so if you need more help from the group I would reccomend a new post,
a code extract, what you expect to happen and what is actually
happening.
HTH,
David.
--
phpmachine :: The quick and easy to use service providing you with
professionally developed PHP scripts :: [url]http://www.phpmachine.com/[/url]
Professional Web Development by David Nicholson
[url]http://www.djnicholson.com/[/url]
QuizSender.com - How well do your friends actually know you?
[url]http://www.quizsender.com/[/url]
(developed entirely in PHP)
David Nicholson Guest



Reply With Quote

