I want to insert row in a table if not already exists else update it. How can I rephrase this query in codeignitor?
INSERT INTO fa_seat_details (mall_id, cineplex_name, audi_number, number_of_rows, number_of_columns) VALUES(15, "PVR", 1, 18, 16) ON DUPLICATE KEY UPDATE cineplex_name = "some name", number_of_rows=10, number_of_columns=20;
This is the table structure,
+-------------------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------------------+-------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| mall_id | int(11) | NO | MUL | NULL | |
| cineplex_name | varchar(64) | NO | | NULL | |
| audi_number | int(11) | NO | | NULL | |
| number_of_rows | int(11) | NO | | NULL | |
| number_of_columns | int(11) | NO | | NULL | |
+-------------------+-------------+------+-----+---------+----------------+