OK, from the very top: how to code and test a query.
// build a query string
$sql = "SELECT * FROM Enq LEFT JOIN order ON Enq.Enqid = order.Enqid";
// run a query in development mode
$result = mysql_query($sql) or die ($sql . '<br />' . mysql_error());
// check the query returned a valid result, which could be empty but still valid
if (!$result) {
echo ' there was a problem running this query<br />' . $sql . '<br />it did not return a valid result';
break;
}
// now find out how many rows it returned
$count = mysql_num_rows($result);
echo $sql . '<br />this query returned ' . $count . ' rows';
That is how to build and test your query. Use it as a seperate test script for any select query. When it works then use the query in your production script.
Never assume that user input is there, or that it is correct even if it does exist. So when you first start to develop and debug queries and the like then hard code any input variables with test value. Then when you pop it into your script and it fails you know the query is good so you can look to the input vars for the fault.
Break everything down into small parts and test them one thing at a time or you will spend half your life chasing after problems by looking in the wrong place.
If that query does not work it means one of these:
1.you have not connected to the db server, check user name and password
2.you have not selected the right db, look for typos in the name
3.you have not used the correct names for your tables or columns
4.the tables are empty