#19173 [Opn->Bgs]: "mssql_query" error
| From: | georg@php.net | Date: | Thu, 29 Aug 2002 21:24:55 +0000 |
| Subject: | #19173 [Opn->Bgs]: "mssql_query" error | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-18189@lists.php.net to get a copy of this message | ||
ID: 19173
Updated by: georg@php.net
Reported By: luchuoyu@hotmail.com
-Status: Open
+Status: Bogus
Bug Type: MSSQL related
Operating System: windows 2000 server
PHP Version: 4.2.2
New Comment:
Sorry, but the bug system is not the appropriate forum for asking
support questions. Your problem does not imply a bug in PHP itself.
For a list of more appropriate places to ask for help using PHP,
please visit http://www.php.net/support.php
Thank you for your interest in PHP.
Previous Comments:
------------------------------------------------------------------------
[2002-08-29 10:23:11] luchuoyu@hotmail.com
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 this bug report at http://bugs.php.net/?id=19173&edit=1