You have two problems there:
- Trying to store a class instance is as they told you (remember that the class should implement
__sleep()
and __wakeup()
so you can choose how to serialize the object - what members will you include in serialization, and how will you re-initialize other members when you deserialize - also remember that the object's class must be defined when you unserualiza
such object).
- Trying to store, particularly, a myqsli object. Those objects contain references to resources which can be collected, so even if you successfully serialize-back such object, their internal references could not be valid anymore.
Your end solution will be, as said before, fetching the rows and keeping them in session. If you don't want to keep the rows (you told there's only one row, but perhaps you don't want an eager-fetching), keep an array with the data to define and bind the query again.