How to empty or truncate mysql table using codeigniter active record?
If you want to empty or truncate a mysql table using Codeigniter active record, use the following code.
To empty
To empty
$this->db->empty_table();This will generate a delete SQL string and runs the query.
// DELETE FROM mytableTo truncate
$this->db->from('mytable'); $this->db->truncate(); // or $this->db->truncate('mytable');This will generate a truncate SQL string and runs the query.
// TRUNCATE mytableSource: http://www.learnhow2do.com/computer/internet/2013/04/13/learn-how-to-empty-or-truncate-table-using-codeigniter-active-record/
very Helpfull ... Thanks For this post.
ReplyDeleteSimply Good
ReplyDelete