#19173 [NEW]: "mssql_query" error

From: Date: Thu, 29 Aug 2002 14:23:11 +0000
Subject: #19173 [NEW]: "mssql_query" error
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-18155@lists.php.net to get a copy of this message
From: luchuoyu@hotmail.com Operating system: windows 2000 server PHP version: 4.2.2 PHP Bug Type: MSSQL related Bug description: "mssql_query" error This is a script of a form: Mssql tables create by the sentence: create table LU_CO_VIP_CLASS( id int IDENTITY (1, 1) NOT NULL, vip_class int null, class_sum_max varchar(32) null, class_sum_min varchar(32) null, class_rebate int null ) Php program: <? $class=$HTTP_POST_VARS['class']; $rebate=$HTTP_POST_VARS['rebate']; $costmin=$HTTP_POST_VARS['costmin']; $costmax=$HTTP_POST_VARS['costmax']; $id=mssql_connect("localhost","sa","admin") or die("CAN NOT CONNECT"); $db=mssql_select_db("netpass_bak",$id); if (!empty($class) and !empty($rebate) and !empty($costmin) and !empty($costmax)) { $query="if exists (select * from LU_CO_VIP_CLASS where vip_class=$class) begin update LU_CO_VIP_CLASS set class_rebate=$rebate, class_sum_min='$costmin', class_sum_max='$costmax' where vip_class=$class end else insert into LU_CO_VIP_CLASS ( vip_class, class_sum_max, class_sum_min, class_rebate) VALUES ( $class, $costmax, $costmin, $rebate)"; mssql_query($query); } $query="select * from LU_CO_VIP_CLASS order by vip_class"; $result=mssql_query($query); //line 78 echo "<font size=5 color=#0000FF><b>CLASS</font></b><br>"; echo "<table width=100% border=1 bordercolor=#FFFFFF cellpadding=1 cellspacing=1><tr bgcolor=#6699FF>"; echo "<td><font size=2>CLASS</font></td>"; echo "<td><font size=2 width=30%>MAX</font></td>"; echo "<td><font size=2>MIN</font></td>"; echo "<td><font size=2>REBATE</font></td></tr>"; while ($arrGuest=mssql_fetch_array($result)) { echo "<tr>"; echo "<td bgcolor=#66CCFF><font size=2>".$arrGuest["vip_class"]."</font></td>"; echo "<td bgcolor=#66CCFF><font size=2 width=30%>$".$arrGuest["class_sum_max"]."</font></td>"; echo "<td bgcolor=#66CCFF><font size=2>$".$arrGuest["class_sum_min"]."</font></td>"; echo "<td bgcolor=#66CCFF><font size=2>".$arrGuest["class_rebate"]."%</font></td>"; echo "</tr>"; } echo "</table>"; ?> The error:MS SQL: Query failed in e:\php\vipclass.php on line 78.(database had been modifyed successfully) But when I cut the segment:" if exists (select * from LU_CO_VIP_CLASS where vip_class=$class) begin update LU_CO_VIP_CLASS set class_rebate=$rebate, class_sum_min='$costmin', class_sum_max='$costmax' where vip_class=$class end else " (only inset into) or cut the segment of insert into(only update) ,it's display right. Is it a bug? -- Edit bug report at http://bugs.php.net/?id=19173&edit=1 -- Try a CVS snapshot: http://bugs.php.net/fix.php?id=19173&r=trysnapshot Fixed in CVS: http://bugs.php.net/fix.php?id=19173&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=19173&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=19173&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=19173&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=19173&r=support Expected behavior: http://bugs.php.net/fix.php?id=19173&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=19173&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=19173&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=19173&r=globals

« previous php.bugs (#18155) next »