-5
$rec = mysql_query("SELECT * FROM records WHERE Remarks=`Opened`");
while($info = mysql_fetch_array($rec))
{
    $emp_query = "SELECT * FROM transactions WHERE Permit_No = '$info[Permit_No]' AND Pend='pending' ORDER BY DESC";
    $pend = mysql_query($emp_query);
    while($row = mysql_fetch_array($pend)) { 
    $id=$row['Permit_No'];
    }
}
Satya
  • 8,420
  • 5
  • 33
  • 52
retfej
  • 1
  • 1
    backticks(`\``) are not the same as single quotes (`'`). Correct your error on the first line with your query and everything will work. – scragar Aug 07 '14 at 13:22
  • [**Please, don't use `mysql_*` functions in new code**](http://bit.ly/phpmsql). They are no longer maintained [and are officially deprecated](http://j.mp/XqV7Lp). See the [**red box**](http://j.mp/Te9zIL)? Learn about [*prepared statements*](http://j.mp/T9hLWi) instead, and use [PDO](http://php.net/pdo) or [MySQLi](http://php.net/mysqli) - [this article](http://j.mp/QEx8IB) will help you decide which. If you choose PDO, [here is a good tutorial](http://j.mp/PoWehJ). – esqew Aug 07 '14 at 13:25

1 Answers1

0

If the query fails (errors out, not return 0 rows), it returns boolean false. Check for success of mysql_query before using.

here's the docs: http://php.net/manual/en/function.mysql-query.php

Your query is erroring on the back ticks as noted in several comments.

Convert the backtics, and check your results.

 $rec = mysql_query("SELECT * FROM records WHERE Remarks='Opened'");
 if($rec != false){
       while($info = mysql_fetch_array($rec)){

   ///... other stuff here
Ray
  • 38,399
  • 19
  • 91
  • 131
  • 2
    This isn't an answer and should be a comment – John Conde Aug 07 '14 at 13:22
  • [`Check this out`](http://stackoverflow.com/questions/25183672/warning-mysql-fetch-array-expects-parameter-1-to-be-resource-boolean-given-i#comment39213206_25183672) before jumping to conclusions. You posted the same backticks around the value. – Funk Forty Niner Aug 07 '14 at 13:23
  • 1
    @Fred-ii- I would have posted my comment as an answer, but the question got locked before I could, so it'll have to do as a comment. Hopefully the poster will see it and can resolve his problem. – scragar Aug 07 '14 at 13:26
  • 1
    @scragar It would have most likely resolved it, however and with questions like these (*I take this from experience*), usually opens up a proverbial "can of worms". Another *possible* and/or additional reason, could be that OP is using `mysqli_` as DB connection. In doing that, will also produce the same error message. I did **+1** your comment, *cheers* – Funk Forty Niner Aug 07 '14 at 13:29