So, I’m trying to achieve a dynamic htaccess ban system, and this line of code is causing me huge problems:
$ip = mysql_query("SELECT ID FROM wp_contactform WHERE Nimi='Christian'");
When I echo it out, it gives me the following:
Resource id #3
The table contains Christian 3 times, with id’s 11, 13 and 10. What’s causing this?
$ipwill simply retrieve the resource representing the resultset – it is not the data itself.You will need to look into using:
to get the
ID.Also keep in mind that this API
(mysql_*)is deprecated, so it may be in your best interests to look into alternative MySQL libraries in PHP:MySQLi: http://php.net/manual/en/book.mysqli.php
MySQL PDO: http://php.net/manual/en/book.mysqli.php