-2
我最近從mysql轉移到mysqli,現在試圖將我的代碼重新格式化爲mysqli。準備了mysqli語句
請指導我這些陳述最新錯誤。
代碼:
<?php
include_once 'dbconnect.php';
$sample ='sample123'; // these are dummy values
$orecip='admin'; // these are dummy values
$omessage='test'; // these are dummy values
$date = date('Y-m-d'); // these are dummy values
$read='yes'; // these are dummy values
$read1='no'; // these are dummy values
$otitle='test'; // these are dummy values
$insert = $MySQLi_CON->query("INSERT INTO messages (user_from, user_to, title, message, date, user_from_read, user_to_read)
VALUES($sample, $orecip, $otitle ,$omessage,$date,$read,$read1)");
print '<h3>Insert Multiple records</h3>';
if($insert){
//return total inserted records using mysqli_affected_rows
print 'Success! Total ' .$MySQLi_CON->affected_rows .' rows added.<br />';
}else{
die('Error : ('. $MySQLi_CON->errno .') '. $MySQLi_CON->error);
}
?>
錯誤:
錯誤:在VALUES部分(1054)在 '字段列表'
http://php.net/manual/en/mysqli.error.php在您的查詢。這裏非常明顯;沒有引號的字符串。 –