HELP: PHP upgrade broke my code!
HELP: PHP upgrade broke my code!
am 30.01.2008 17:31:40 von steveg1701
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!
Re: PHP upgrade broke my code!
am 30.01.2008 19:29:55 von Paul Lautman
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?
Re: PHP upgrade broke my code!
am 31.01.2008 01:21:09 von steveg1701
On Jan 30, 1:29 pm, "Paul Lautman"
wrote:
> steveg1...@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?
It's passed to the routine as a parameter. if I echo $MyQuery to the
output and paste the resultant query to MySQL then it works as
expected.
Re: PHP upgrade broke my code!
am 31.01.2008 15:05:15 von zeldorblat
On Jan 30, 7:21 pm, steveg1...@yahoo.com wrote:
> On Jan 30, 1:29 pm, "Paul Lautman"
> wrote:
>
>
>
> > steveg1...@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?
>
> It's passed to the routine as a parameter. if I echo $MyQuery to the
> output and paste the resultant query to MySQL then it works as
> expected.
Enable error reporting in PHP and turn it up all the way -- then see
if you get any errors when you run your script.
Re: PHP upgrade broke my code!
am 31.01.2008 16:55:14 von Norman Peelman
ZeldorBlat wrote:
> On Jan 30, 7:21 pm, steveg1...@yahoo.com wrote:
>> On Jan 30, 1:29 pm, "Paul Lautman"
>> wrote:
>>
>>
>>
>>> steveg1...@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 ""
If that's copy & pasted from your script then check your quote usage on
that line. All I see is double quotes cancelling each other out. Try:
echo "DEBUG next is '$Answer'";
>>>> 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?
>> It's passed to the routine as a parameter. if I echo $MyQuery to the
>> output and paste the resultant query to MySQL then it works as
>> expected.
>
> Enable error reporting in PHP and turn it up all the way -- then see
> if you get any errors when you run your script.
--
Norman
Registered Linux user #461062