0

When I use something like this:

$stmt = $dbConnection->prepare('SELECT * FROM employees WHERE name = ?');
$stmt->bind_param('s', $name);

$stmt->execute();

$result = $stmt->get_result();
while ($row = $result->fetch_assoc()) {
    // do something with $row
}

according this answer:

How can I prevent SQL injection in PHP?
I get this error:

Call to undefined method mysqli_stmt::get_result()

Because get_result is available only with mysqlnd (get_result php reference).
So is there any alternative how to get all columns? If I don't want bind all columns(using bind_result()), because in my case I do query on 3 tables and I just dont want bind all columns because it is an insane job.
So I don't want use bind_result(), get_resuslt doesn't work is there any alternative or it means I cant use prepared statements and only chance is get back to this:

sql = "SELECT * FROM ...." //just some query
$query = mysqli_query($db_donnection, $sql);


while ($row = mysqli_fetch_array($query, MYSQLI_ASSOC)) {
    $id = $row["id"];
    $e = $row["email"];
    //....
}
Community
  • 1
  • 1
user1097772
  • 3,499
  • 15
  • 59
  • 95
  • Please avoid using contractions such as "wanna" and "(be)cause" - for some readers that's the difference between understanding, misunderstanding or not the question. I would ordinarily just correct the text but your history indicates it's a persistent habit. – AD7six Mar 29 '14 at 19:45
  • @AD7six edited if it's so big deal .. – user1097772 Mar 29 '14 at 19:51

0 Answers0