title: Error in SQL syntax, check for right syntax to use near '0' at line 1
body: <p>I have meet the error mentioned in the title, here is the code in my PHP file, I have tried to reform my query, but fail to correct the error, can anyone tell me why there is such kind of error, is there the way I form the error is incorrect? I have seen some similar posts, but what I know from those posts is the problem should be my query, but I have no idea how to change it. So may I ask for your help to tell me where is the problem of my query, this can definitely help me to make clear my concept.</p>
  
  <pre><code>$query = "SELECT * 
      FROM Tech AS T, Client AS C, Site AS S, Log AS L 
      WHERE T.TechID=L.TechID, C.ClientID=L.ClientID, S.SiteID=L.SiteID";
  if($sort=="Tech")
     $query += "ORDER BY T.TechName ASC, L.Time DSC";
  else if($sort=="Client")
     $query += "ORDER BY C.ClientName ASC, L.Time DSC";
  $result = mysql_query($query) or die('Error! ' . mysql_error());; 
  print "Real-Time check in/check out&lt;br&gt;";
  print "&lt;table&gt;&lt;th&gt;&lt;td&gt;Tech&lt;/td&gt;&lt;td&gt;Client&lt;/td&gt;&lt;td&gt;Site&lt;/td&gt;";
  print "&lt;td&gt;Date and Time&lt;/td&gt;&lt;td&gt;Type&lt;/td&gt;&lt;/th&gt;";
  while($row = mysql_fetch_array($result)){
  print "&lt;tr&gt;&lt;td&gt;".$row['T.TechName']."&lt;/td&gt;";
  print "&lt;td&gt;".$row['C.ClientName']."&lt;/td&gt;";
  print "&lt;td&gt;".$row['S.SiteName']."&lt;/td&gt;";
  print "&lt;td&gt;".$row['L.Time']."&lt;/td&gt;";
  print "&lt;td&gt;".$row['L.Type']."&lt;/td&gt;&lt;/tr&gt;";
  }
  print "&lt;/table&gt;";
  </code></pre>
  
  <p>Below is the error message:</p>
  
  <blockquote>
    <p>Error! 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 '0' at line 1</p>
  </blockquote>