data display - problem - 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: data display - problem (/showthread.php?tid=37406) |
data display - problem - El Forum - 01-08-2011 [eluser]penta997[/eluser] Helo. I have a problem with displaying data from model. Instead subcategory list, controller displaying only the last record from subcategorys. This is my model code: Code: <?php and this is controller: Code: <?php I need help, please. data display - problem - El Forum - 01-08-2011 [eluser]cideveloper[/eluser] in function get_sub_category change Code: $this->response['result'] = $row; to Code: $this->response['result'] .= $row; data display - problem - El Forum - 01-09-2011 [eluser]penta997[/eluser] It doesnt work, now i have a php error: Severity: 4096 Message: Object of class stdClass could not be converted to string Filename: controllers/ksiegarnia.php Line Number: 95 data display - problem - El Forum - 01-09-2011 [eluser]Cristian Gilè[/eluser] in your controller: Code: function get_sub_category($id) Cristian Gilè data display - problem - El Forum - 01-09-2011 [eluser]penta997[/eluser] now i have an error: Trying to get property of non-object. Maybe is something wrong in my view, where i trying return my data? This is view left.php Code: <div class="cat_name"><?php echo $category->CAT_Name; ?></div> data display - problem - El Forum - 01-09-2011 [eluser]Cristian Gilè[/eluser] If you use string concatenation (.=) subcategory is a string, so you have to echo it directly: Code: <div class="subcat_name"><a href="#"><?php echo $subcategory; ?></a></div> Cristian Gilè data display - problem - El Forum - 01-09-2011 [eluser]penta997[/eluser] You're right. Thank you very much for help. |