Newbie array question |
[eluser]brixxster[/eluser]
Hello everyone, I have an array Code: $data['rows'] ( 'fname' => My Name, 'lname' => My Last name, 'acct_type' => 2) I wanted to test acct_type so I can redirect to specific function according to its value. I'm using switch case for the testing, what is the correct syntax for getting the acct_type value in the array? I'm still a newbie so forgive me if this reads like a dumb question. thanks everybody.
[eluser]JHackamack[/eluser]
Depending on the array type (object or regular) it would either be Code: //regular or Code: //object If you are using active record to set the $data['rows'] array then it is probably object, but if you are setting it yourself then its probably regular.
[eluser]brixxster[/eluser]
Thanks for the quick reply jhackamack but unfortunately I still got errors. Here's the snippet of the code I have in the controller... Code: $this->load->model('model_membervalidation'); I don't know what I'm doing wrong here...
[eluser]JHackamack[/eluser]
can you paste in the results from Code: echo "<pre>";
[eluser]brixxster[/eluser]
here's the result... Code: Array
[eluser]JHackamack[/eluser]
Ah, i see the problem, you have an array under an array. Code: echo $data['rows'][0]->acct_type; Try that.
|
Welcome Guest, Not a member yet? Register Sign In |