Q:

php sql max where id2=$id2

i'm trying to find the highest number in my table (named huur) from column Borga but only for the user where the ID2 is equal to the number i have in the variable named $ID2. The highest number should go into the variable $hoogste_borg
this is the code i'm using, but i get invalid syntax error? what am i doing wrong?
<?php 
    $query="SELECT MAX('Borga') FROM huur ORDER BY ID DESC LIMIT 1 WHERE ID2='$ID2'";
    $result=mysql_query($query) or die ("Error: ".mysql_error());
    while ($row=mysql_fetch_array($result)) 
    {
    $hoogste_borg=$row['Borga'];
    }
?>

A:

ORDER BY and LIMIT must go after WHERE clauses. -- http://dev.mysql.com/doc/refman/5.0/en/select.html
SELECT MAX('Borga')
   FROM huur
   WHERE ID2='$ID2'
   ORDER BY ID DESC 
   LIMIT 1 

