Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<h3>Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given</h3> <p>First and foremost:</p> <blockquote> <p><a href="https://stackoverflow.com/questions/12859942/why-shouldnt-i-use-mysql-functions-in-php"><strong>Please, don't use <code>mysql_*</code> functions in new code</strong></a>. They are no longer maintained <a href="https://wiki.php.net/rfc/mysql_deprecation" rel="noreferrer">and are officially deprecated</a>. See the <a href="http://uk.php.net/manual/en/function.mysql-connect.php" rel="noreferrer"><strong>red box</strong></a>? Learn about <a href="http://en.wikipedia.org/wiki/Prepared_statement" rel="noreferrer"><em>prepared statements</em></a> instead, and use <a href="http://php.net/pdo" rel="noreferrer">PDO</a> or <a href="http://php.net/mysqli" rel="noreferrer">MySQLi</a> - <a href="http://php.net/manual/en/mysqlinfo.api.choosing.php" rel="noreferrer">this article</a> will help you decide which. If you choose PDO, <a href="http://wiki.hashphp.org/PDO_Tutorial_for_MySQL_Developers" rel="noreferrer">here is a good tutorial</a>.</p> </blockquote> <hr> <p>This happens when you try to fetch data from the result of <code>mysql_query</code> but the query failed.</p> <p>This is a warning and won't stop the script, but will make your program wrong.</p> <p>You need to check the result returned by <code>mysql_query</code> by </p> <pre><code>$res = mysql_query($sql); if (!$res) { die(mysql_error()); } // after checking, do the fetch </code></pre> <p>Related Questions:</p> <ul> <li><a href="https://stackoverflow.com/questions/2973202/mysql-fetch-array-expects-parameter-1-to-be-resource-boolean-given-in-select">mysql_fetch_array() expects parameter 1 to be resource, boolean given in select</a></li> <li><a href="https://stackoverflow.com/search?q=Warning:%20mysql_fetch_array%28%29%20expects%20parameter%201%20to%20be%20resource&amp;submit=search">All "mysql_fetch_array() expects parameter 1 to be resource, boolean given" Questions on Stackoverflow</a></li> </ul> <p>Related Errors:</p> <ul> <li><a href="https://stackoverflow.com/questions/12769982/reference-what-does-this-error-mean-in-php/14067623#14067623">Warning: <em>[function]</em> expects parameter 1 to be resource, boolean given</a></li> </ul> <p>Other <code>mysql*</code> functions that also expect a mysql result resource as parameter will produce the same error for the same reason.</p>
 

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