title: Accessing object's properties via array index
body: <p>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.</p>
  
  <p>I searched <a href="http://www.php.net/manual/en/sdo.sample.getset.php" rel="nofollow">php doc</a> and found that I can use $objectName[index] to access the database property. I am getting error </p>
  
  <p><code>Cannot use object of type stdClass as array in C:\....php on line ..</code> . </p>
  
  <p>The erroneous line is indicated on the code</p>
  
  <pre><code>private function uploadTemp($databaseObject, $table_name){
      $this-&gt;load-&gt;database();
      //get file_contents too;
      $file_id = $databaseObject[3]; // &lt; Here's where the error appeared
      $this-&gt;db-&gt;from('tbl_file')-&gt;where('file_id',$file_id); 
      $q = $this-&gt;db-&gt;get();
      $data = $q-&gt;row();
      $query = "INSERT INTO $table_name VALUES(NULL, '".$databaseObject[2]."','".$data-&gt;filecontent."');";
      $this-&gt;db-&gt;query($query);
  }
  </code></pre>
  
  <p>I am using CodeIgniter as a framework.</p>