Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

delete all lines from a table with CODEIGNITER

Tags:

codeigniter

How can I delete all lines from a table with codeigniter. Just a line I know, just specify the id from this line, but what about all lines at once? Thanks

like image 318
Luciano Avatar asked Dec 18 '16 20:12

Luciano


People also ask

How to delete an existing record from a table in CodeIgniter?

In CodeIgniter, delete() method is used to delete an existing record from database table. $table(mixed):- The table(s) to delete from. Delete Record using $this->db->delete() This is how you can delete a record from ’employee_master’ table using $this->db->delete().

What is the difference between truncate () and delete () in CodeIgniter?

The Codeigniter Delete function is used to delete the one or more row data from database table. The truncate () method of codeigniter is used to remove all records from a database table. It performs the same function as a DELETE statement without a WHERE clause. My name is Devendra Dode.

How to retrieve data from MySQL database in CodeIgniter?

Initially, all the records from the users table are listed in an HTML table. The user can select single or multiple rows in the table and delete multiple records from the MySQL database in CodeIgniter application. All the user’s data are retrieved from the database. Multiple rows can be selected using checkbox provided on each table row.

How do I delete selected records from the database?

By clicking the checkbox in the table header, all checkboxes will be checked or unchecked. Once the delete button is clicked, a dialog will appear for the confirmation. After the confirmation, the form is submitted to delete selected records from the database. <!--


1 Answers

$this->db->empty_table('my_table');

Put it in your model and don't give any where before that.

like image 78
cssBlaster21895 Avatar answered Oct 11 '22 20:10

cssBlaster21895