You are here: My blindness or php bug « PHP Programming Language « IT news, forums, messages
My blindness or php bug

Posted by Bob Stearns on 09/26/05 22:11

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.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация