Welcome Guest, Not a member yet? Register   Sign In
Failed in getting the results array
#1

[eluser]Mimi kesini[/eluser]
hello all,
I am confused to get the array. I have tried to put the foreach in the view and controller, but the results are still not readable.
on which part goes wrong?

need help.... Thank you in advance Smile

controller:
Code:
$hi = array();
        $query = $this->db->query("SELECT WallStatus, DateStatus FROM wall WHERE UID = ".$uid." ORDER BY DateStatus DESC");
        foreach ($query->result() as $status)
        {
            $s  = '<tr><td style="width:330px;">'.$status->WallStatus.'</td></tr><br/>';
            $s .= '<tr><td align="right" style="width:330px;">'.$status->DateStatus.'</td></tr>';
            $hi[] = $s;
        }
        $data['wallResult'] = $hi;
        var_dump($data['wallResult']);
        //$this->load->view('profilePhoto_view',$data);

result the var_dump:
array(8) { [0]=> string(123) "asdfghjkl
07.Feb.2011 12:21" [1]=> string(125) "qqqwertyuio
07.Feb.2011 12:21" [2]=> string(138) "qwertyuiosdfghjklzxcvbnm
07.Feb.2011 12:21" [3]=> string(182) "Ngudag jdwl pelm man jm12 trz qe blikna jm4 lgs kbdung uy maman wkwk
.... }

view:
Code:
<table align="left" cellpadding="4" cellspacing="0" border="0">
                        &lt;?php foreach ($wallResult as $data): ?&gt;
                               <tr><td style="width:330px;">&lt;?php echo $data->WallStatus; ?&gt;</td></tr><br/>
                               <tr><td align="right" style="width:330px;">&lt;?php echo $data->DateStatus; ?&gt;</td></tr>
                        &lt;?php endforeach; ?&gt;
                        </table>
#2

[eluser]InsiteFX[/eluser]
Try this:
Code:
&lt;?php foreach ($wallResult as $data => $value): ?&gt;

InsiteFX




Theme © iAndrew 2016 - Forum software by © MyBB