I have a situation where i have to programmatically do database inserts. I have multiple tables but the order of information of those tables are similar , i.e, in each table, the first coulmn in id, and second is a foregin key, and third is a name, and fourth is a blob and fifth is a text.
I searched php doc and found that I can use $objectName[index] to access the database property. I am getting error
Cannot use object of type stdClass as array in C:\....php on line .. .
The erroneous line is indicated on the code
private function uploadTemp($databaseObject, $table_name){
$this->load->database();
//get file_contents too;
$file_id = $databaseObject[3]; // < Here's where the error appeared
$this->db->from('tbl_file')->where('file_id',$file_id);
$q = $this->db->get();
$data = $q->row();
$query = "INSERT INTO $table_name VALUES(NULL, '".$databaseObject[2]."','".$data->filecontent."');";
$this->db->query($query);
}
I am using CodeIgniter as a framework.
$file_id = $databaseObject[3];that triggers the error?