[eluser]Ludovic-r[/eluser]
Well, the JOIN works well and update the both Tables. But there's a new problem now :
When I update my "category names" I do this in the MODEL :
Code:
$this->db->truncate('ft_categories');
$this->db->insert_batch('ft_categories', $data);
$query = $this->db->query("UPDATE ft_categories, ft_upload_data
SET category = ft_categories.category_name
WHERE test_id = category_id");
Another thing, to create a Category I have this :
Code:
function create_category($data) {
$this->db->insert('ft_categories', $data);
$query = $this->db->query("UPDATE ft_categories
SET category_id = category_id + 1
");
}
This will increment the 'cat.id' field in the Table 1 to do the JOIN with the 'dat.id' in the Table 2
The problem is that "truncate" will empty the Table 1 ('ft_categories') so I lost my JOINED ids when I UPDATE the fields and the 'cat.id' in the Table 1 does not match anymore with the 'dat.id' in the Table 2
I'm a bit lost at this state :/ any help would be very appreciated.