title: LEFT JOIN: error in getting the userid from the session
body: <blockquote>
    <p>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 '<code>left join image on gallery.gal_id=image.gal_id WHERE</code>' at line 3</p>
  </blockquote>
  
  <p>could appreciate some help</p>
  
  <pre><code>SELECT username,count(image.img_id) as no,gallery,gallery.gal_id 
  FROM user 
  left join gallery on user.userid=gallery.userid 
  left join left join image on gallery.gal_id=image.gal_id
  WHERE userid = '" . $_SESSION['userid'] . "'";
  </code></pre>