This should actually give me an error: "Fatal blabla.. cannot convert object to string... blabla".. because it returns $this.. but it doesn't. It just displays blank.
Anyone see the problem?
That's because the return value (which is assigned to $fetch) isn't an object instance, it's NULL.
If some SQL is passed through to exeQuery, the else block is followed. This block just calls $this->loadQuery(SQL)->exeQuery(); then exits the if/else block. Following that route, nothing is returned from exeQuery so $fetch will be NULL which will print nothing when echoed.
As sketchMedia said, just put return before that loadQuery/exeQuery line.
The Following User Says Thank You to Salathe For This Useful Post:
I don't see anywhere in your code where it should say "cannot convert object to string..."
Is that part somewhere else?
No, it's a PHP-generated error, fatal errors are caused by PHP, and not really "outputted" anywhere in the code.
It's like.. when you try to connect to a db with the wrong settings, it gives an errormsg that it can't connect to the database, even if you haven't said anywhere that it should output that specific message.
Originally Posted by allworknoplay
Also can we see the rest of your class or is it too big? Like do you have any other properties declared etc...
It's quite big, but since it's solved now it doesn't really matter