PHP Query Help

Discussion in 'PHP' started by crazyryan, Aug 2, 2007.

  1. #1
    $query = mysql_query("SELECT SUM(rating) FROM `ratings` WHERE `fileid` = '" . $id . "'"); 
    $rate = mysql_fetch_assoc($query);
    echo $rate['rating'];
    PHP:
    I'm trying to get the number that query returns, I ran the query in phpmyadmin and it returned a number, but when I try and get it using the code above it doesn't show anything, help appreciated :(
     
    crazyryan, Aug 2, 2007 IP
  2. exodus

    exodus Well-Known Member

    Messages:
    1,900
    Likes Received:
    35
    Best Answers:
    0
    Trophy Points:
    165
    #2
    SELECT SUM(rating) AS ?? FROM `ratings` WHERE `fileid` '".$id."'
     
    exodus, Aug 2, 2007 IP