Welcome Guest, Not a member yet? Register   Sign In
Check if database exists and create table if it doesn't
#1

[eluser]maddtechwf[/eluser]
I'm creating a plugin for a web app that was created with CodeIgniter. I'm trying to test to see if a table exists in the database and if it doesn't then I want to create the table with it's fields.

Any suggestions?
#2

[eluser]InsiteFX[/eluser]
Code:
if ($this->db->table_exists('table_name'))
{
   // some code...
}
#3

[eluser]maddtechwf[/eluser]
Would this work?

Code:
if($this->db->table_exists('my_tbl') == FALSE)
{
      call_function();
}
#4

[eluser]InsiteFX[/eluser]
Yes, it returns TRUE or FALSE




Theme © iAndrew 2016 - Forum software by © MyBB