Hi,

in http://www.php.net/manual/en/function.mysqli-stmt-bind-result.php it remains unclear whether bind_result must be called after every execute or if one call for many statements of a kind is sufficient.

I.e. I use a prepared SELECT statement:

// prepare
$stmt = $mysqli->prepare(
  "SELECT title FROM books WHERE title LIKE ? LIMIT 5");
$stmt->bind_param('s', $pattern);

// first execution of SELECT command
$pattern="%Linux%";
$stmt->execute();
$stmt->bind_result($title);
while($stmt->fetch())
  printf("<br />%s\n", $title);

// second execution of SELECT command, with different pattern
$pattern="%MySQL%";
$stmt->execute();
// IS THE FOLLOWING bind_result NECESSARY?
// $stmt->bind_result($title);
while($stmt->fetch())
  printf("<br />%s\n", $title);
$stmt->close();

I kind of answered my question myself -- it works without a second call of bind_result. However, is this just good luck or is this the intended behavior?

Best wishes,


Michael Kofler

http://www.kofler.cc/

Reply via email to