Another way is to use Query Binding which automatically escapes all the values:
$sql = "INSERT IGNORE INTO my_table(lat, lng, date, type) VALUES (?,?,?,?);";
$this->db->query($sql, array($data['lat'], $data['lng'], $data['date'], $data['type']));
More Related Contents:
- Grouping WHERE clauses in Codeigniter
- How to select rows where column value IS NOT NULL using CodeIgniter’s ActiveRecord?
- how to select only one value sql
- How to create codeigniter dynamic menu from single table
- Comma separated numeric values – PHP CodeIgniter
- CodeIgniter – foreach loop
- PHP – Change value y,n in database [closed]
- How to insert multiple rows from array using CodeIgniter framework?
- strange character encoding of stored data , old script is showing them fine new one doesn’t
- CodeIgniter: Unable to connect to your database server using the provided settings Error Message
- Find total number of results in mySQL query with offset+limit
- How to create Codeigniter batch insert array
- How to add an ORDER BY clause using CodeIgniter’s Active Record methods?
- How can I Use Prepared Statements in CodeIgniter
- What are the differences between backtick and single quote? Can I use IF statement in a query as above?
- How to create Codeigniter language files from database?
- Trying to get property of non-object – CodeIgniter
- Codeigniter Transactions
- Inserting NOW() into Database with CodeIgniter’s Active Record
- Using utf8mb4 with php and mysql
- how do I get month from date in mysql
- How can I redirect a 404 Error in a custom 404 page using Codeigniter?
- How do I save PHP session data to a database instead of in the file system?
- Difference between mysql_fetch_array and mysql_fetch_row?
- MySQL, how to insert null dates
- Can I detect and handle MySQL Warnings with PHP?
- using mysql_close()
- Should I disable MySQL strict mode?
- Using PDO Prepared Statement and Incrementing a column value
- Displaying BLOB image from Mysql database into dynamic div in html