mysqli prepared statement help

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
adrivetest
Forum Newbie
Posts: 3
Joined: Thu Apr 10, 2008 4:12 am

mysqli prepared statement help

Post 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();
Stokestack
Forum Newbie
Posts: 14
Joined: Thu Sep 16, 2010 2:37 am

same

Post by Stokestack »

I have the same problem. Started a new thread with a more descriptive title.
Post Reply