Welcome Guest, Not a member yet? Register   Sign In
Object of class stdClass could not be converted to string
#1

[eluser]anpmtp[/eluser]
got me an error in my site...
Object of class stdClass could not be converted to string error occured when loading my page
this error occured in _serialize($data) function session.php library.
how can i solve ir
#2

[eluser]pickupman[/eluser]
Could you post some code? This type of error maybe from a library not being loaded, or you are passing the wrong data type to a function.
#3

[eluser]Unknown[/eluser]
array([0]=> stdClass Object ([id]=>1 [title]=>sabbir [content]=>My name is sabbir [date]=>2011-01-29))

A php error was encountered
massage: Object of class stdClass could not be converted to string

Code:
controller:
$data['query'] = $this->blog_model->get_blog();
$this->load->view('blogview',$data);
view:
<?php foreach($query as $value)
echo $value;
endforeach;
?>

there is no fetching problem.first line indicate that.
#4

[eluser]Cristian Gilè[/eluser]
Code:
<?php
foreach($query as $value)
{
      echo $value->id;
      echo $value->title;
      echo $value->content;
      echo $value->date;
}
?>
If $query returns a single result row and not an array of objects, you can avoid the foreach. Read the user guide.


Cristian Gilè




Theme © iAndrew 2016 - Forum software by © MyBB