For Programmers: Free Programming Magazines  


Home > Archive > PHP Programming > September 2005 > My blindness or php bug









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author My blindness or php bug
Bob Stearns

2005-09-26, 6:56 pm

The problem is that some functioning (I thought) code has stopped working:

$n = @odbc_num_rows($res);
$debug .= "<br>isset(n) " . $code . "=" . isset($n) . ";<br>";
$debug .= "<br>ncode " . $code . "=$ncode;<br>";
$debug .= "<br>n " . $code . "=$n;<br>";
switch ($ncode) {
case -2: /* 0 or 1 */
if(!isset($n) || (($n!=0) && ($n!=1))) {
$debug .= "<br>-2 " . $code . "=-2;<br>";
$myerr = TRUE;
$mymsg .= $code . " " . $msg . "<br><br>";
}
break;
case -1: break; /* don't care */
case 0: /* exactly 0 *\
if(!isset($n) || ($n!=0)) {
$debug .= "<br>0 " . $code . "=0;<br>";
$myerr = TRUE;
$mymsg .= $code . " " . $msg . "<br><br>";
}
break;
case 1: /* exactly one */
if(!isset($n) || ($n!=1)) {
$debug .= "<br>1 " . $code . "=1;<br>";
$myerr = TRUE;
$mymsg .= $code . " " . $msg . "<br><br>";
}
break;
case 2: /* at least one */
if(!isset($n) || ($n<1)) {
$debug .= "<br>2 " . $code . "=2;<br>";
$myerr = TRUE;
$mymsg .= $code . " " . $msg . "<br><br>";
}
break;
}

gives the following output:

isset(n) V ID=1;

ncode V ID=0;

n V ID=0;

1 V ID=1;

myerr=1; mymsg=V ID res-03 is already known id

which indicates case 1 was executed when case 0 was called for.
Paul Herber

2005-09-26, 6:56 pm

On Mon, 26 Sep 2005 15:11:10 -0400, Bob Stearns
<rstearns1241@charter.net> wrote:

> The problem is that some functioning (I thought) code has stopped working:


> case 0: /* exactly 0 *\


>which indicates case 1 was executed when case 0 was called for.


incorrect end of comment

--
Regards, Paul Herber, Sandrila Ltd. http://www.pherber.com/
SanDriLa - SDL/MSC/TTCN/UML2 application for Visio http://www.sandrila.co.uk/
Bob Stearns

2005-09-26, 6:56 pm

Paul Herber wrote:
> On Mon, 26 Sep 2005 15:11:10 -0400, Bob Stearns
> <rstearns1241@charter.net> wrote:
>
>
>
>
>
>
>
>
> incorrect end of comment
>

Thank you! I thought it was something of that order, but I couldn't see
it. Occasionally fresh eyes are necessary.
Michael Vilain

2005-09-26, 6:56 pm

In article <8kYZe.10249$eH2.7678@fe02.lga>,
Bob Stearns <rstearns1241@charter.net> wrote:

> Paul Herber wrote:
> Thank you! I thought it was something of that order, but I couldn't see
> it. Occasionally fresh eyes are necessary.


A color coding editor has be come quite a comfort to me in my old age.
You might try vim in php mode. I don't know if emacs also does color
coding. Or the Zend editor.

--
DeeDee, don't press that button! DeeDee! NO! Dee...



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com