I have a simple login system protection mechanism by recording the user's IP, failed attempt number and last attempt time to a MySQL database table named
bannedusers. However when I attempt to use the following code below to insert a new entry into the database the execute() function returns false and fails to execute.
Code as follows:
I'm rather new to php and MySQL and through research I have found that the SQL syntax apparently needs quotation marks around the fields for the VALUE section of the query like:
$query = "INSERT INTO bannedusers (ip, retrycount, attempttime) VALUES ('?','?','?')";
but I have found here that it actually stops the query from working (still tried it and got a error on bind_param()). I've tried changing the type to 'sii' or 'sss' or 'ssi' all which resulted in the query failing. I've tried adding a semicolon at the end of the SQL query but that changed nothing. In all cases the "failed query!" dialog box pops up with no other error (except the one mentioned above give I use quotation marks around the VALUES fields.
Any help is appreciated.
It turned out that
$ip was somehow
null before being passed into the function which only causes a error if the MySQL error level is raised to MYSQLI_REPORT_ALL.