Jump to content

How do I access the result of this query?


moon 111

Recommended Posts

My query is this:

 

SELECT AVG(rating) FROM rating WHERE sid = '34' LIMIT 1

 

And my code:

 

<?php

$q = "SELECT AVG(rating) FROM rating WHERE sid = '34' LIMIT 1";
$r = mysql_query($q);
$rating = mysql_fetch_array($r);
$rating = $rating['AVG(rating)']; // How can I do this correctly?

?>

 

How do I access the result?

Thanks

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.