I was trying to return a set of objects.
But this code gives me the following error:
Catchable fatal error: Object of class User could not be converted to string in …
public function fetchObject($psClassname ='',$paParams =array()){ $lrResource = $this->mrQueryResource; $liResult = null; while($row = mysql_fetch_object($lrResource,$psClassname,$paParams)){ $liResult .= $row; <-this line produces the error } return $liResult; }
In your code $row is a an object (you’ve used mysql_fetch_object), and the .= operator tries to build a string, concatenating $liResult and $row. I believe this behaviour only works if your object implements a toString method
You could return an array of rows using this code: