私は一日中この問題を解決しようとして運が悪かった. 定数が引数として直接使用されているという質問を見てきました。ただし、私の引数はすべて変数です。本当に明らかな何かが欠けていますか?
$one = 1;
$two = 2;
$three = 3;
if ( !($stmt = $mysqli->prepare('INSERT INTO test3 (one, two, three) VALUES (?, ?, ?)')) ) {
echo "Prepare failed (".$stmt->errno.") ".$stmt->error."\n";
$stmt->close();
exit();
}
if ( !($stmt->bind_param('iii',$one,$two,$three)) ) {
echo "Failed to bind (".$stmt->errno.") ".$stmt->error;
$stmt->close();
exit();
}
if ( !($stmt->execute) ) {
echo "Execute failed (". $stmt->errno.") ". $stmt->error."\n";
$stmt->close();
exit();
}
編集:私は実際に使用してbind_param
いましたが、さまざまなことを試した後、元に戻すのを忘れていました。コードはそのままコピペしました。bind_value を bind_param に戻した後も、同じエラーが発生します。
EDIT 2: 私はばかげているように感じます。PHP ファイルを新しい名前で保存したので、コードを簡素化できましたが、その変更を反映するために POST メソッドの URL を変更するのを忘れていました。したがって、現在取得しているエラーは次のとおりですUndefined property: mysqli_stmt::$execute
。mysql ログの対応する出力は次のとおりです。
42 Connect test@localhost on testdb
42 Prepare [1] INSERT INTO test3 (one, two, three) VALUES (?, ?, ?)
42 Quit