-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);
}
?>
Ошибки:
Ошибка: (1054) Неизвестный столбец 'sample123' в 'списке поля'
http://php.net/manual/en/mysqli.error.php по вашему запросу. Довольно очевидно здесь; некотируемые строки. –