$query = mysql_query("SELECT sum(rating) FROM stars WHERE post_id = 20");
echo $query;
It outputs:
Resource id #3
instead of 8, which is what the actual sum is.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
$query, after executing the query doesn’t have just a number. It’ll have a Resource just like any other query you would execute.In order to actually get the result, treat it like you would treat any other resource: