Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Firstly, we see in the error message that there was a <code>boolean given</code> - the only reason <a href="http://php.net/manual/en/function.mysql-query.php" rel="nofollow"><code>mysql_query()</code></a> returns a boolean for a SELECT query is if the query failed - which it will have done because you have a syntax error in your SQL. You need to change some of the single quotes to backticks:</p> <pre><code>$query = " SELECT `ip_count` FROM `count_ip` WHERE `ip_count` = '$ip_add' "; </code></pre> <p>Object names (columns, tables etc) should be quoted with backticks `, anything surround with single quotes ' is treated as a literal string.</p> <p>You need to check for the failure of the query:</p> <pre><code>$query_run = mysql_query($query); if (!$query_run) { // Handle error here } $query_num_rows = mysql_num_rows($query_run); </code></pre> <p>Some additional comments:</p> <ul> <li>Try and indent your code more sensibly, it will make it much easier to debug in the long run</li> <li>Avoid the use of global variables, they are very bad practice, especially when you are populating them with data that is already <a href="http://php.net/manual/en/language.variables.superglobals.php" rel="nofollow">superglobal</a></li> <li><a href="http://bobby-tables.com/" rel="nofollow">Make sure you escape any data from external sources before using it in a database query</a></li> <li>Don't use the <code>mysql_*</code> functions, use <a href="http://php.net/manual/en/book.pdo.php" rel="nofollow">PDO</a> or <a href="http://php.net/manual/en/book.mysqli.php" rel="nofollow">MySQLi</a></li> </ul>
    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.
    3. 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