![]() |
View - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: View (/showthread.php?tid=32285) |
View - El Forum - 07-19-2010 [eluser]Unknown[/eluser] function display(){ $img_id = 1; $this->load->database(); $this->db->select('img_name, img_id'); $query = $this->db->get('upload',array('img_id' => $img_id )); echo "<pre>"; print_r($query);echo "</pre>"; echo "<pre>"; print_r($this->db->get('upload'));echo "</pre>"; foreach ($query->result() as $row) { echo "<pre>"; print_r($row);echo "</pre>"; $temp['image']['img_id'] = $row->img_id; $temp['image']['img_name'] = $row->img_name; } $this->load->view('showImage'); } <?php foreach($image as $row):?> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td>Image Id</td> <td> <?php echo $row['img_id'];?> </td> </tr> <tr> <td>Image Name</td> <td> <?php echo $row['img_name'];?> </td> </tr> </table> <?php endforeach;?> I have this funcion, in Controller, and I want to display it in View, I have tried it alot, but I can't write its View File,and I get these errors while... Help me, cz i m hanged View - El Forum - 07-19-2010 [eluser]Phil Sturgeon[/eluser] Instead of echoing, just assign it to a variable. Code: function display(){ View - El Forum - 07-19-2010 [eluser]Unknown[/eluser] A PHP Error was encountered Severity: 4096 Message: Object of class CI_DB_mysql_result could not be converted to string Filename: controllers/upload.php Line Number: 67 A PHP Error was encountered Severity: Notice Message: Undefined variable: temp Filename: views/showImage.php Line Number: 1 A PHP Error was encountered these errors arose after using the follow up function Severity: Warning Message: Invalid argument supplied for foreach() Filename: views/showImage.php Line Number: 1 |