Bookmarks

Yahoo Gmail Google Facebook Delicious Twitter Reddit Stumpleupon Myspace Digg

Search queries

sqldatasource dal, wwwxxxenden, convert raid5 to raid 10 mdadm, apache force chunked, nrao wwwxxx, xxxxxdup, procmail change subject header, wwwXxx not20, Wwwxxx.doks sas, linux raid resync after reboot

Links

XODOX
Impressum

#1: HELP: PHP upgrade broke my code!

Posted on 2008-01-30 17:31:40 by 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!

Report this message

#2: Re: PHP upgrade broke my code!

Posted on 2008-01-30 19:29:55 by 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?

Report this message

#3: Re: PHP upgrade broke my code!

Posted on 2008-01-31 01:21:09 by steveg1701

On Jan 30, 1:29 pm, "Paul Lautman" <paul.laut...@btinternet.com>
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.

Report this message

#4: Re: PHP upgrade broke my code!

Posted on 2008-01-31 15:05:15 by zeldorblat

On Jan 30, 7:21 pm, steveg1...@yahoo.com wrote:
> On Jan 30, 1:29 pm, "Paul Lautman" <paul.laut...@btinternet.com>
> 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.

Report this message

#5: Re: PHP upgrade broke my code!

Posted on 2008-01-31 16:55:14 by Norman Peelman

ZeldorBlat wrote:
> On Jan 30, 7:21 pm, steveg1...@yahoo.com wrote:
>> On Jan 30, 1:29 pm, "Paul Lautman" <paul.laut...@btinternet.com>
>> 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

Report this message