php
Total 2 posts

When to use bind_result vs get_result in mysql

Using bind_result() would be better for query's without wild card (*), for example:

/* Use bind_result() with fetch() */
$query1 = 'SELECT id, first_name, last_name, username FROM table WHERE id = ?';

Using get_result() would be better for query's with wild card (*), for example:

/* Use get_result() with fetch_assoc() */
$query2 = 'SELECT * FROM table WHERE id = ?';
Continue Reading