CodeIgniter Tutorial News section |
(07-28-2015, 08:15 AM)christaliise Wrote: I like to learn how to create the table automatically using PHP and in accordance with the Tutorial. Undoubtedly when the table is created the Tutorial will explain the query process. The database forge library allows you to modify/create/drop tables. http://www.codeigniter.com/user_guide/da...forge.html It also helps to know the database library's metadata methods for things like finding out if a table exists before you create it: http://www.codeigniter.com/user_guide/da...adata.html So, for example, you might do something like this: PHP Code: if ( ! $this->db->table_exists('table_name')) { Note that you would normally do something like this in a migration, so you can add/remove the table as needed using the migration library. |
Welcome Guest, Not a member yet? Register Sign In |