CodeIgniter Forums
Fatal error - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Fatal error (/thread-57494.html)



Fatal error - El Forum - 03-19-2013

[eluser]ede196620[/eluser]
i am geting this error

Code:
Fatal error: Cannot use object of type stdClass as array in C:\wamp\www\Surva\application\views\displayEdit.php on line 20

on this line:

Code:
<td>&lt;input type="text" name="QID" disabled="disable" class="text" value="&lt;?php echo (isset($query['QID']))?$query['QID']:''; ?&gt;"/&gt;&lt;/td>

i cant figure why can anyone help ?


Fatal error - El Forum - 03-19-2013

[eluser]PhilTem[/eluser]
It's because you're accessing an object as if it were an array (exactly what the error code tells you). Your code snippet shows the "bad code" at around the "$query[' "-part.

Try changing the access scope from array to object. Then it should work


Fatal error - El Forum - 03-19-2013

[eluser]ede196620[/eluser]
Can u show me how it should look i am weary new to codeigniter still have a lot to learn

is it something like this
Code:
$query->

EDIT

That was the answer its fixed