Warning: mssql_query() [function.mssql-query]: message: Syntax error converting the varchar value 'credits + 50' to a column of data type int. (severity 16) in C:\AppServ\www\mu2.php on line 12
Warning: mssql_query() [function.mssql-query]: Query failed in C:\AppServ\www\mu2.php on line 12
Code Code (PHP)
<?
$objConnect = mssql_connect("2009-EE57FEC235","sa","3571");
$objDB = mssql_select_db("MuOnline");
$strSQL = "SELECT count(*) as total FROM MEMB_CREDITS WHERE memb___id = '$userid'";
$objQuery = mssql_query($strSQL);
if($row['total'] == 0){
$strSQL = "INSERT INTO MEMB_CREDITS( credits, memb___id) VALUES('credits + {$amount}', '$userid')";
}
else{
$strSQL = "UPDATE MEMB_CREDITS SET credits=credits + {$amount} WHERE memb___id='$userid'";
}
mssql_query($strSQL);
?>
Date :
2010-05-31 17:21:55
By :
Sososaity
No. 6
Guest
$strSQL = "INSERT INTO MEMB_CREDITS( credits, memb___id) VALUES('$amount', '$userid')";
Warning: mssql_query() [function.mssql-query]: message: Violation of PRIMARY KEY constraint 'PK_MEMB_CREDITS'. Cannot insert duplicate key in object 'MEMB_CREDITS'. (severity 14) in C:\AppServ\www\mu2.php on line 12
Warning: mssql_query() [function.mssql-query]: Query failed in C:\AppServ\www\mu2.php on line 12
code
Code (PHP)
<?
$objConnect = mssql_connect("2009-EE57FEC235","sa","");
$objDB = mssql_select_db("MuOnline");
$strSQL = "SELECT count(*) as total FROM MEMB_CREDITS WHERE memb___id = '$userid'";
$objQuery = mssql_query($strSQL);
if($row['total'] == 0){
$strSQL = "INSERT INTO MEMB_CREDITS( credits, memb___id) VALUES('$amount', '$userid')";
}
else{
$strSQL = "UPDATE MEMB_CREDITS SET credits=credits + {$amount} WHERE memb___id='$userid'";
}
mssql_query($strSQL);
?>