Reading query results/Resource ID problem

Code:
$query = “SELECT MAX(playlist_id) FROM yoga_user_playlist”;
$result = mysql_query($query);

Im trying to get the max value for playlist id and set that equal to a variable, which ive been able to do althought it keeps setting it to a resource ID, how do i get teh actual value?

[php]$query = “SELECT MAX(playlist_id) AS max FROM yoga_user_playlist”;
$result = mysql_query($query);
$maxid = mysql_fetch_assoc($result);
$maxid = $maxid[‘max’];
[/php]

[php]$query = “SELECT MAX(playlist_id) AS max FROM yoga_user_playlist”;
$result = mysql_query($query);
$maxid = mysql_fetch_num($result);
$maxid = $maxid[0];[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service