Posted by Paul Lautman on 01/30/08 18:29
steveg1701@yahoo.com wrote:
> Hi, I hope one of you gurus out there can help me. I have a web
> application that had been running fine before I upgraded my server,
> now it fails on the following snippet of code:
>
> function NextOrder($OrderID) {
> ConnectDatabase();
> $MyQuery = "SELECT OrderID FROM `Orders` WHERE (OrderID > $OrderID)";
> $request = mysql_query($MyQuery);
> list($Answer) = mysql_fetch_row($request);
> echo "DEBUG next is ""$Answer""";
> return $Answer;
> }
>
> When this code is interpreted it outputs this:
>
> DEBUG next is ""
>
> Not surprisingly, I have a companion routine that looks essentially
> the same except for the < operator replacing > and sort order
> descending - it fails in the same way. if however, for the purpose of
> testing I replace the < with a = then the code works as expected;
>
> Did I find a bug in PHP/MySQL somewhere or am I doing something wrong
> that I was getting away with before and now getting my hand slapped by
> smarter software? ;-)
>
> The environment that this worked under is
>
> PHP 5.2.0
> SuSE 10.2 x586 32 bit
> MySQL 5.0.26-12
> PHP5-MySQL 5.2.0-10
>
> Environment it failed under
>
>
> PHP 5.2.4
> SuSE 10.3 x86 64 bit
> MySQL 5.0.45-22 x86 64 bit
> PHP5-MySQL 5.2.4-10 x86 64 bit
>
>
> Thanks in advance for any light you can shed on this!
Where/how does the value $OrderID get set?
[Back to original message]
|