MYSQL query, is this possible?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
scrambleded
Forum Newbie
Posts: 1
Joined: Tue Jul 22, 2008 6:34 pm

MYSQL query, is this possible?

Post by scrambleded »

$rater = 'SELECT rating_sum FROM #__content_rating WHERE content_id=743';

in the table content_rating and on the content_id 743 the rating sum is 4

so why does

echo $rater; // propduce nothing???


I would greatly appreciate any help, thanks.
WebbieDave
Forum Contributor
Posts: 213
Joined: Sun Jul 15, 2007 7:07 am

Re: MYSQL query, is this possible?

Post by WebbieDave »

User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: MYSQL query, is this possible?

Post by califdon »

scrambleded wrote:$rater = 'SELECT rating_sum FROM #__content_rating WHERE content_id=743';

in the table content_rating and on the content_id 743 the rating sum is 4

so why does

echo $rater; // propduce nothing???


I would greatly appreciate any help, thanks.
What is the purpose of the #_ ?
User avatar
Buddy
Forum Newbie
Posts: 9
Joined: Tue Apr 08, 2008 9:28 am

Re: MYSQL query, is this possible?

Post by Buddy »

try these:

Code: Select all

 
 
$rater = 'SELECT rating_sum FROM #__content_rating WHERE content_id=743';
 
$result=mysql_query($rater);
 
while ($row = msql_fetch_array($result))
{
    $rs[]=$row['rating_sum'];
}
 
print_r($rs);
 
 
Post Reply