<?php
$Article_Type_Code=$Article_Type_Code;
$Article_Year=$Article_Year;
$Article_ID=$Article_ID;
$Article_Name=$Article_Name;
$License_Number=$License_Number;
$Retrive_Cost=$Retrive_Cost;
$Organize_ID=$Organize_ID;
$Official_ID=$Official_ID;
$Retrive_From=$Retrive_From;
$Retrive_Time=$Retrive_Time;
//Set Fields Not Null For Report
if (trim($Article_Name)=="") {
$Article_Name="-";
}
if (trim($Brandname)==""){
$Brandname="-";
}
if (trim($Model_Desc)=="" ){
$Model_Desc="-";
}
if (trim($Color)=="" ){
$Color="-";
}
//Set Fields Not Null For Report
$re1 = mssql_query("SELECT * FROM Article WHERE Article_Type_Code='".$Article_Type_Code."' AND Article_ID='". $Article_ID."' ");
echo $Article_Type_Code;
$num1 = mssql_num_rows($re1);
if($num1 == 0){
$User_ID1 = $_SESSION[User_ID];
$Update_Time1 = date("j/n/Y");
$ad1 = mssql_query("insert into Article(Article_Type_Code,Article_Year,Article_ID,Article_Name,License_Number,User_ID,Update_Time)VALUES($Article_Type_Code,$Article_Year,$Article_ID,$Article_Name,$License_Number,$User_ID1,$Update_Time1)");
}
?>
Warning: mssql_query(): message: Incorrect syntax near '052'. (severity 15) in c:\appserv\www\pam(mink)\license_update.php on line 41
Warning: mssql_query(): Query failed in c:\appserv\www\pam(mink)\license_update.php on line 41
'052' --->ที่echoออกมาอะค่ะ
Warning: mssql_num_rows(): supplied argument is not a valid MS SQL-result resource in c:\appserv\www\pam(mink)\license_update.php on line 43
Warning: mssql_query(): message: Incorrect syntax near '052'. (severity 15) in c:\appserv\www\pam(mink)\license_update.php on line 42
Warning: mssql_query(): Query failed in c:\appserv\www\pam(mink)\license_update.php on line 42
Run แล้วมันขึ้นแบบนี้ค่ะ
SELECT * FROM Article WHERE Article_Type_Code=''052'' AND Article_ID=''0013''
Warning: mssql_num_rows(): supplied argument is not a valid MS SQL-result resource in c:\appserv\www\pam(mink)\license_update.php on line 47
Warning: mssql_query(): message: Violation of PRIMARY KEY constraint 'PK_Article'. Cannot insert duplicate key in object 'dbo.Article'. (severity 14) in c:\appserv\www\pam(mink)\license_update.php on line 53
Warning: mssql_query(): Query failed in c:\appserv\www\pam(mink)\license_update.php on line 53
insert into Article(Article_Type_Code,Article_Year,Article_ID,Article_Name,License_Number,User_ID,Update_Time)VALUES('052','52','0013',' aaa','bbb',1,29/4/2009)