Jump to content

Witch mysqli_* to use instead of mysql_result() ?


Lykos22

Recommended Posts

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 by Lykos22
Link to comment
Share on other sites

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 by Lykos22
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...