我收到以下預編譯語句代碼的錯誤。想知道是什麼原因,因爲它看起來都是正確的。與COUNT(..)不起作用的簡單預處理語句
Notice: Connection failed: Prepared statement invalid: Operand should contain 1 column(s) in C:\xampp\htdocs\index.php on line 58
下面的代碼:
$conn = new mysqli('localhost', 'root', '', 'myusers'); // this is confirmed to work for connecting
// Check connection
if ($conn->connect_error) {
trigger_error('Connection failed: ' . $conn->connect_error);
die();
}
$stmt = $conn->prepare('SELECT COUNT(id) as count_u FROM Users WHERE (title=?, forename=?, surname=?)');
if (!$stmt) { // here, $stmt is false or such.
trigger_error('Connection failed: Prepared statement invalid: ' . htmlspecialchars($conn->error));
die();
}
你'WHERE'條款是不正確。提示:'AND'。 –
'(title = ?, forename = ?, surname =?)'有效嗎? –