Welcome Guest, Not a member yet? Register   Sign In
initialize the Forge class
#1

[eluser]chejnik[/eluser]
Hello, I have probably very simple question, sorry.

How can I initialize the Forge class. According to user guide my database driver should be running.
Before I load forge class, I make few queries, so I guess that my driver is running. Is that true?

this function from model view
Code:
function create_UniqueUserStructure($user, $structure)
    {
         $this->load->dbforge();
    
    $this->dbforge->add_field('id');
    foreach($structure as $row) {
        
        $helper = $row['databaseRowName'];
        switch ($row['inputName']) {
        case 'VARCHAR':
            $fields[$helper] ['type']=$row['inputName'];
            $fields[$helper] ['constraint']=$row['inputLenght'];
            break;
        case 'TEXT':
            $fields[$helper] ['type']=$row['inputName'];
            break;
        case 'TINYINT':
            $fields[$helper] ['type']=$row['inputName'];
            $fields[$helper] ['constraint']=$row['inputLenght'];
            break;
        }
        
    
    }
    
        $this->dbforge->add_field($fields);
    $table_name='ds_'.$user;
    $this->dbforge->create_table($table_name, TRUE);

   }

Thank you. Ales




Theme © iAndrew 2016 - Forum software by © MyBB