Prepared statement expects 0 params with 1 given .., using php manual example -


i took straight php manual example -- identical needed still getting error.

can tell me missing?

$stmt = $link->prepare("select obitbody, photo tnobit obitid = ?"); if ($stmt->execute(array($_post['obitid']))) {   while ($row = $stmt->fetch()) {     print_r($row);   } } 

mysqli_stmt::execute() expects 0 parameters, 1 given in

execute (the object-based one, opposed older less-favored variant) doesn't take parameters.

from query , attempted parameters execute, looks you're trying pass needed parameters array execute call. not how it's done.

you need bind variables ? markers in separate call before calling execute.

this question (once fixed accepted answer) shows general process need follow:

  • create statement;
  • prepare statement;
  • bind parameters;
  • execute (with no parameters);
  • store result (if buffering);
  • bind result variables;
  • fetch (in loop, likely);
  • close statement.

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -