[eluser]xwero[/eluser]
A simplified version of what i wanted to do
Code:
$this->db->from('table');
$fields = $this->db->list_fields('table');
foreach($fields as $field)
{
if(isset($_POST[$field]))
{
$set[$field] = $_POST[$field];
}
}
if(isset($set)){ $this->db->set($set); }
$this->db->insert();
Gives me an error 'You must set the database table to be used with your query.' which comes from the insert method. This means the db->list_fields method is cleaning the data added for the sql statement, in this case from the db->from method.
I wonder if the list_fields has to have this behavior or if it's something that could be changed?
I know you can circumvent it by placing the from method lower but i like to keep the sql statement order.