shaunysj — 2012-05-20T07:26:01-04:00 — #1
Hi guys, i was following this video tutorial.. then i came across this function - mysql_result($query_run,0,'id') .Is at the video time 7:00.
Ok, the problem is i have been using mysqli to connect to my db, mysqli_query etc.
I tried using mysql_result($query_run,0,'id') but it give me this error - mysql_result() expects parameter 1 to be resource.
Then i tried mysqli_result($query_run,0,'id') they give me this error - Call to undefined function mysqli_result()
So is the a way to solve this without changing all mysqli to mysql and able to get the same result?
chris_upjohn — 2012-05-20T08:28:21-04:00 — #2
The MySQL result function was changed in MySQLi into a class of methods which you can see [here, the method you would want to use would be [URL="http://www.php.net/manual/en/mysqli-result.fetch-array.php"]mysqli_result::fetch_array](http://php.net/manual/en/class.mysqli-result.php) which returns an array with the results you requested.
shaunysj — 2012-05-20T08:37:24-04:00 — #3
Thanks for the clear explanation! I tried mysqli_fetch_array, it works exactly as what is intended. Thanks for your help
chris_upjohn — 2012-05-20T08:39:22-04:00 — #4
No problem, glad you got it working