You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LIMIT 1' at line 2

I m getting this error while entering my query in the php code..
my code is

function get_subject_by_id($subject_id)
{
    global $subject;
    global $connection;
    $query = "SELECT *
              FROM subjects WHERE id=" . $subject_id . " " ;
    $query .= "LIMIT 1";

    $result_set = mysql_query($query, $connection);
    confirm_query($result_set);
   if ( $$subject == mysql_fetch_array($result_set))
    {
        return $subject;
    }
    else {
        return NULL;

    }



Kindly help me in this prob

Put the following on the line 8:

die($query);

and post what you get. It might be that the $subject_id is empty or not set.