php - What to replace mysql_result with for MySQLi -
what replace mysql_result
with?
im watching tutorial made in 2011 not working now. here situation, grateful if tell me replace mysql_result here, , put in parenthesis
function update_count() { global $link; $query = "select `count`, `hits_count`"; if($query_run = mysqli_query($link, $query)) { $count = mysql_result($query_run, 0, 'count'); $count_inc = $count + 1; echo $count; } } update_count();
mysqli_query
returns mysqli_result
object. there, can value want.
if($query_run = mysqli_query($link, $query)) { // gets 1 row @ time, use while if there multiple rows // while($row = mysqli_fetch_assoc($query_run)){} $row = mysqli_fetch_assoc($query_run); $count = $row['count']; // whatever $count }
Comments
Post a Comment