Lykos22 Posted February 18, 2013 Share Posted February 18, 2013 (edited) I have created some custom functions like these: function folder_exists($folder){ global $connection; $sql_folder_exists = "SELECT COUNT(`album_id`) FROM `albums` WHERE `folder` = '{$folder}' LIMIT 1"; $folder_exists = mysql_query($sql_folder_exists, $connection) or die(mysql_error()); return (mysql_result($folder_exists, 0) == 1) ? true : false;} function total_users(){global $connection;$sql_total_users = "SELECT COUNT(`user_id`) FROM `users` ";$total_users = mysql_query($sql_total_users,$connection) or die(mysql_error());return mysql_result($total_users, 0);} , but I decided to use the mysqli_* functions instead. My question is which mysqli_ function is used instead if the mysql_result in these cases??? I've searched through the manual and gives these functions mysqli_data_seek() , mysqli_field_seek() and mysqli_fetch_field(), but when i tried them they did not gave me the expected result and obviously ther's no mysqli_result() function. Edited February 18, 2013 by Lykos22 Link to comment Share on other sites More sharing options...
justsomeguy Posted February 18, 2013 Share Posted February 18, 2013 Fetch field gets metadata about a field, not the value. It's probably easiest to get the result using fetch_array and then get the value from that. Link to comment Share on other sites More sharing options...
Lykos22 Posted February 18, 2013 Author Share Posted February 18, 2013 (edited) Fetch field gets metadata about a field, not the value. It's probably easiest to get the result using fetch_array and then get the value from that.I don't get it, so instead of mysql_result($total_users, 0), I should return mysqli_fetch_array($total_users)??? Edited February 18, 2013 by Lykos22 Link to comment Share on other sites More sharing options...
justsomeguy Posted February 18, 2013 Share Posted February 18, 2013 Get the result first, and return the same boolean where you check the value of the field. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now