Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You aren't checking the return from <a href="http://au2.php.net/manual/en/function.mysql-query.php" rel="nofollow">mysql_query</a>, which returns false on error.</p> <p>You should check the return value, then check the error given:</p> <pre><code>if ($result === false) { //die is ok to use in development, //use something you can handle the error with in production. die(mysql_error()); } </code></pre> <p>The error in your query is you are using <code>&amp;&amp;</code> and not <code>AND</code> which is expected by MySQL.</p> <p><strong>Note:</strong> Assuming you have not hidden notices, you should see:</p> <blockquote> <p>Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given</p> </blockquote> <p>Its best to develop with all <a href="http://au2.php.net/manual/en/function.error-reporting.php" rel="nofollow"><code>error_reporting</code></a> on <code>E_ALL</code>, so you can see any notices/warning that may be causing you errors.</p> <hr> <p>Here is your query in more readable formatting:</p> <pre><code>SELECT registration.hosteladmissionno, registration.student_name, registration.semester, messexp.billmonth, messexp.billyear, messexp.wastagecharge, exp_amount.blockexp // Trying to select from a table not included in the FROM FROM registration, messexp, blockexp // I'm assuming you want exp_amount from this table. WHERE registration.mess_type = '".$q."' AND status_flag=1 // Changed to be using AND not &amp;&amp; </code></pre> <p>Did you mean to select <code>blockexp.exp_amount</code>?</p> <p>The way you current query is, its saying fetch the values in the exp_amount table in the column blockexp (which doesn't exist or hasn't been included anyway.)</p> <p>If you want all the fields from blockexp, use <code>blockexp.*</code></p> <hr> <p>The next issue you are going to have is you aren't specifying how these tables are joined at all. So I believe you are going to get every possible combination of rows.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload