-2
最近mysqlからmysqliに移行しました。これで、mysqliのコードを再フォーマットしようとしています。mysqliのprepared statement
私はこれらの声明で何が間違っているかを案内します。
コード:
<?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);
}
?>
エラー:
エラー:(1054)不明な列 'sample123' 'フィールドリスト' で
http://php.net/manual/en/mysqli.error.phpここでかなり明らかです。引用符で囲まれていない文字列。 –