Storing IP as binary type in DB |
Hi,
I have a table which keeps failed logins. IP stored in VARBINARY(16) column. I don't have any experience with BINARY types in MySql. Problem is when I want to do query by comparing by IP sometimes it throws db error: SELECT MAX(attempted_at) as last_failed_attempt FROM failed_login WHERE attempted_at > DATE_SUB('2017-04-19 17:26:18', INTERVAL 60 MINUTE) AND (ip_address = 'Xç'e' OR 1 = 0) My model: get max attempts: Code: $now = date($this->config->item('log_date_format')); what is wrong in my query? Insert query: Code: $insert_data = array(
You are trying to compare a string against binary data which just doesn't work. Trying doing some research on how to select binary data.
|
Welcome Guest, Not a member yet? Register Sign In |