[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
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">
<?php foreach ($wallResult as $data): ?>
<tr><td style="width:330px;"><?php echo $data->WallStatus; ?></td></tr><br/>
<tr><td align="right" style="width:330px;"><?php echo $data->DateStatus; ?></td></tr>
<?php endforeach; ?>
</table>