1

I have an array $cand_detail . print_r($cand_detail) shows :

Array ( [0] => Array ( [0] => stdClass Object ( [cand_f_name] => Nitish [cand_l_name] => Dolakasharia [cand_email] => [email protected] [cand_password] => *5D47AA16D3C7B8B748B89E16DE11C54CB0CF37DF [cand_phone] => 7878777887 [cand_qualification] => ba [cand_industry] => [cand_experience_yr] => 0 [cand_experience_mn] => 5 [cand_message] => [cand_id] => 1 [cand_resume] => resume/tourist map details.doc ) ) [1] => Array ( [0] => stdClass Object ( [cand_f_name] => Anupam [cand_l_name] => Baruah [cand_email] => [email protected] [cand_password] => *5D47AA16D3C7B8B748B89E16DE11C54CB0CF37DF [cand_phone] => 45465465 [cand_qualification] => eng_mch [cand_industry] => [cand_experience_yr] => 3 [cand_experience_mn] => 4 [cand_message] => [cand_id] => 2 [cand_resume] => resume/tourist map details.doc ) ) ) 

Now I assigned the values to smarty :

$this->assign_values('cdetail',$cand_detail);

And in smarty :

{foreach name = feach item = v from = $cdetail}
    First Name : {$v.cand_f_name}<br />
{/foreach}

But it is not showing the first names of the candidates , it is coming black.

1 Answer 1

1

The item in the array is an object, so you need to point to the field using ->. Also, it appears you are using a two-dimensional array.

{foreach name = feach item = clist from = $cdetail}
    {foreach item = v from = $clist}
        First Name : {$v->cand_f_name}<br />
    {/foreach}
{/foreach}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.