Welcome Guest, Not a member yet? Register   Sign In
$this->db->insert contain fields which I had not delibrately specified.[SOLVED]
#1

[eluser]Unknown[/eluser]
Hi, I am new to this forum and have been using codeigniter for almost 6 months.

I am currently being bothered by something which I had ran out of ideas to solve
Code:
function newMedia($data){
   $dataset=array(
'name'=>$data['file_name'],
'origName'=>$data['orig_name'],
'file_path'=>$data['file_path'],
'full_path'=>$data['full_path'],
'file_ext'=>$data['file_ext'],
'file_size'=>$data['file_size'],
'raw_name'=>$data['raw_name'],
'image_size_str'=>$data['image_size_str'],
'is_image'=>$data['is_image'],
'dateOfCreation'=>time()
);
       $this->db->insert('medias',$dataset);
       ...

}

The above code however gave me the following error.
Quote:Unknown column 'group_id' in 'field list'

INSERT INTO `medias` (`group_id`, `name`, `origName`, `file_path`, `full_path`, `file_ext`, `file_size`, `raw_name`, `image_size_str`, `is_image`, `dateOfCreation`) VALUES ('2', 'Koala1.jpg', 'Koala.jpg', '/home/willwebc/public_html/snobbox/ShopLogo/', '/home/willwebc/public_html/snobbox/ShopLogo/Koala1.jpg', '.jpg', 762.53, 'Koala1', 'width=\"1024\" height=\"768\"', 1, 1322303180)

I was told that there is no group_id in my database, which is exactly the case because it does not have group_id. But however, when I run $this->db->insert, somehow the query generated by $this->db->insert has this column.I am puzzled...

Please advice on what else i can do and if there is another thread that may help me, please direct me to it as well.

Thank you in advance =).




Theme © iAndrew 2016 - Forum software by © MyBB