SROSeaner Posted September 1, 2009 Share Posted September 1, 2009 Hi, I am trying to learn to use the MySQLi classes (MySQLi,MySQLi_STMT,MySQLi_Result) with great confusion. I like the ability to create prepared statements, but also value the use of fetching associative arrays for the results. I can prepare my statements no problem, and think it's great for sql injection prevention, but is there no way to store those results into a MySQLi_Result object as well (if it receives results in a SELECT statement, for example) so I can then fetch assoc array from the mysqli_result object? Thanks for any insight, Sean Quote Link to comment https://forums.phpfreaks.com/topic/172751-proper-use-of-mysqli-improved-extension/ Share on other sites More sharing options...
PFMaBiSmAd Posted September 1, 2009 Share Posted September 1, 2009 $stmt->fetch() fetches a row from the result set and places the selected values into the variables setup with $stmt->bind_result(). How is that any different from fetching a row and accessing the elements of the array? You could use array elements in $stmt->bind_result() if you desperately wanted to use array syntax to access the values from the query - $stmt->bind_result($row['name'], $row['code']); Quote Link to comment https://forums.phpfreaks.com/topic/172751-proper-use-of-mysqli-improved-extension/#findComment-910552 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.