Welcome Guest, Not a member yet? Register   Sign In
[Solved] Database Forge problem creating a table
#1

[eluser]Unknown[/eluser]
Hi, I'm trying to create a table using the database forge class, I receive the fields via JSON ajax to my php and then convert them into array that looks like the following:
Code:
$fields =
array(3) {
  ["test_id"]=>
  array(3) {
    ["type"]=>
    string(3) "INT"
    ["constraint"]=>
    string(1) "5"
    ["auto_increment"]=>
    string(4) "TRUE"
  }
  ["f1"]=>
  array(3) {
    ["type"]=>
    string(7) "VARCHAR"
    ["constraint"]=>
    string(3) "255"
    ["default"]=>
    string(6) "Field1"
  }
  ["f2"]=>
  array(2) {
    ["type"]=>
    string(4) "TEXT"
    ["null"]=>
    string(4) "TRUE"
  }
}


Then I add the fields and create the table like this:

Code:
if($this->dbforge->add_field($fields)) echo 'Fields OK';
else echo 'Fields KO';

if($this->dbforge->create_table($_POST['name'], TRUE)) echo 'Table OK';
else echo 'Table KO';
The extrange thing is the output is 'Fields KO Table OK' but the table is not created.

And there's not any warning nor error anywhere not even in the logs.

Can anyone give me a hand?

Thanks.




Theme © iAndrew 2016 - Forum software by © MyBB