Severity: 4096 Message: Object of class CI_DB_mysql_result could not be converted to string |
[eluser]kazza[/eluser]
Hi everyone Im new to codeigniter ans was loving it...until this "Severity: 4096 Message: Object of class CI_DB_mysql_result could not be converted to string" I have read through the posts and looked at whats going on, tried loads of those tricks and still getting the above error. Any suggestions would be gratefully accepted model... Code: [color=blue]function [/color]getAll() view... Code: <?php echo $query = $this->db->query("SELECT title, content, displaypage, image_lower, image_upper FROM pages WHERE displaypage = 'contact'"); is it also worth mentioning that all the data is displayed how and where i want it, but also includes the unwanted error msg
[eluser]CroNiX[/eluser]
Take a look at this line: Code: <?php echo "<img src='$row->image_lower'></div>
[eluser]kazza[/eluser]
Thanks for the help - i tried a few things [code] <?php echo "<img src='$row->image_lower'
[eluser]kazza[/eluser]
Thanks for the help - i tried a few things [code] <?php echo "<img src='$row->image_lower'
[eluser]CroNiX[/eluser]
I would write it as: Code: <?php echo '<img src="' . $row->image_lower . '" alt="" /></div>'; ?>
[eluser]kazza[/eluser]
that maintains the pretty but still has the error.... my tiny brain hurts
[eluser]CroNiX[/eluser]
Now compare that to the other image you are outputting...
[eluser]kazza[/eluser]
[quote author="vbsaltydog" date="1327034883"] Code: <?php var_dump($row); ?> Code: object(stdClass)#17 (5) { ["title"]=> string(28) "Email [email protected]" ["content"]=> string(345) "While produce that is purchased in the supermarket has been in transit or cold-stored for days or weeks, produce that you purchase at your local farmers market has been picked within 24 hours of your purchase. This freshness not only affects the taste of your food, but the nutritional value which declines with time." ["displaypage"]=> string(7) "contact" ["image_lower"]=> string(0) "" ["image_upper"]=> string(44)
[eluser]vbsaltydog[/eluser]
As you can see in the output of var_dump, your property is empty. FYI. You have bad code in your method and you are calling sql data in your view file which breaks the MVC design pattern. |
Welcome Guest, Not a member yet? Register Sign In |