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! Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.