Welcome Guest, Not a member yet? Register   Sign In
Fatal error: Cannot use string offset as an array in .... user_view.php on line 12
#1

[eluser]Unknown[/eluser]
Hi, I was receiving this type of error my times in codeigniter, The main issue that I have found and resolved this error is following!

1- If we are providing wrong file name and class name used in file then generate that type of error. e.g

file name is user_school_info.php and class name that we have defined in that file is
Code:
class School_info {
}
then I have got this type of error.

2- If I am returning an array of naming index and retrieving with different name then found this type of error! e.g

return array as
Code:
$users['info']['teacher']
and trying to retrieve in view class as an different name.

3- Appending an array after a string e.g
Code:
$user = 'test';
  $user['info'] = 'Our data'

Appending an array after string also display that type of error! So make sure that we have create an array for array values! :-)




Hoping this tutorial will help you to understand why we receive this type of error!




Theme © iAndrew 2016 - Forum software by © MyBB