[eluser]whobutsb[/eluser]
Hello All,
I'm working a on a method that allow me to create additional fields in a database if they don't already exist in the database.
Here is the method I wrote:
Code:
$this->load->dbforge();
foreach($fields as $field){
//Check to see if each exists in the database
if(!$this->db->field_exists($field, $tableName)){
//Add the column if it doesn't exist
$column = array(
$field => array(
'type' => 'VARCHAR',
'constraint' => '255',
'NULL' => TRUE
)
);
$this->dbforge->add_column($tableName, $column);
}
}
The problem is when I run this I get this output:
Error Number:
ALTER TABLE _tblDis_MyTestGuestsLis ADD Array NOT NULL
It looks like the DBforge is not taking apart the array I wrote and is just outputting the array. Maybe i'm missing something with all of this? BTW I'm using MSSQL, would that have something to do with it?
Thanks for help!
steve