[eluser]Kenshiro[/eluser]
The only thing i could see wrong with your query is the ID field, as it's an auto field i guess, just leave it out of your query...
Code:
$query = "INSERT INTO ci_images (imagetype, usage, usage_id, size_num, size, name, fullpath, comment) VALUES ( '$data[imagetype]', '$data[usage]', '$data[usage_id]', '$data[size_num]', '$data[size]', '$data[name]', '$data[fullpath]', '$data[comment]')";
$r = $this->db->query($query);
Also numeric data should be treated as numeric, that meane, '$data['usage_id']' should be written $data['usage_id'] (without the quotes), lastly as you are using " (double quotes) to have your array parsed directly i think errors might arise as well, cause $data[imagetype] should actually be $data['imagetype'] or else imagetype is assumed to be a constant or var by php (when it's not).
So i would actually write the query this way :
Code:
$query = 'INSERT INTO ci_images (imagetype, usage, usage_id, size_num, size, name, fullpath, comment) VALUES ( "'.$data[imagetype].'", "'.$data[usage].'", '.$data[usage_id].', '.$data[size_num].', "'.$data[size].'", "'.$data[name].'", "'.$data[fullpath].'", "'.$data[comment].'")';
$r = $this->db->query($query);
//even better if you are building with mysql and don't plan on switching of DB engine anytime soon there is a simple way to write the sql query in an update syntax manner.
$query = 'INSERT INTO ci_images SET imagetype = "'.$data['imagetype'].'", usage = "'.$data['usage'].'", usage_id = '.$data['usage_id'].', size_num = '.$data['usage_id'].', size = "'.$data['size'].'", name = "'.$data['name'].'", fullpath = "'.$data['fullpath'].'", comment = "'.$data['comment'].'"';
$r = $this->db->query($query);
// Or lastly use the Active record way...