jagg3rz Posted August 17, 2011 Share Posted August 17, 2011 Hey guys, I was wondering what is the best way to grab multiple rows from a database using prepared statements? Would it be something similar to this? $stmt = $this->_con->prepare('MY QUERY'); if ($stmt) { $stmt->execute(); $stmt->bind_result($lol, $lol2, $lol3); $rows = array(); while ($stmt->fetch()) { $item = array( 'lol' => $lol, 'lol2' => $lol2 ); $rows[] = $item; } $stmt->close(); return $rows; } This seems to work but i want to know if there is any other/better ways of doing it. Thanks! Link to comment https://forums.phpfreaks.com/topic/245032-best-way-to-return-rows-from-array-prepared-statements/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.