Page 1 of 1

mysqli prepared statement help

Posted: Wed Apr 30, 2008 3:52 am
by adrivetest
is there any way to retrieve our records' individual field without using bind_result?? I miss the way mysqli->query used to do..we had the choice to use fetch_row, fetch_array etc..

i've searched high and low for any example..but i can't seem to find any.

usually for prepared statements you'll do something like this :

Code: Select all

$stmt = $mysqli->prepare($sql);
$stmt->execute();
$stmt->bind_result($field1, $field2);
 
while($stmt->fetch()){
  echo $field1, $field2;
}
 
$stmt->close();

but is there any way to do it like this ?

Code: Select all

$stmt = $mysqli->prepare($sql);
 
$result = $stmt->execute(); //maybe somehow, theres a function to return a set of records
 
while($row = $result->fetch_row()){
  echo $row[0], $row[1];
}
 
$stmt->close();

same

Posted: Sat Nov 13, 2010 6:08 pm
by Stokestack
I have the same problem. Started a new thread with a more descriptive title.