You are here: Re: [PHP] Problem serializing a mysqli_result object. « PHP « IT news, forums, messages
Re: [PHP] Problem serializing a mysqli_result object.

Posted by "Richard Lynch" on 07/11/05 12:18

On Thu, July 7, 2005 10:31 pm, Bjarke Freund-Hansen said:
> Richard Lynch wrote:
>
>>On Thu, July 7, 2005 12:53 pm, Bjarke Freund-Hansen said:
>>
>>
>>>>You can't serialize resource objects. Try:
>>>>
>>>>serialize($res->fetch_assoc());
>>>>
>>>>
>>>I know I can serialize the array fetch_assoc returns, but I really need
>>> to
>>>serialize a mysqli_result, so I can feed it to any function expecting a
>>>mysqli_result.
>>>
>>>
>>
>>The connection simply WILL NOT survive the ending of a PHP script.
>>
>>Period.
>>
>>
> But I'm not trying to keep the connection, I don't care about the
> connection. What I want to serialize is the object returned from
> mysqli->query().

That object is tightly tied to the connection.

It ain't gonna survive either.

>>If you want to hack the PHP source to try to change that, go for it...
>>
>>
> I've gone so far as to rewrite the mysqli_result class (in PHP), and
> parse the object returned from mysqli->query() to my own class, and
> serialize that one. Which I guess will work. But is that really the
> easiest way?

I guess...

If it's working for you, and you are aware that the object you create when
you un-serialize has lost some of its inherent properties, I think, then I
guess it's okay.

Does it actually work? I mean, can you iterate through the rows it returned?

I guess my first question should have been:

Why?

What do you gain by serializing and unserializing a result object?

NOTE:
It's possible the mysqli API is *so* different from mysql API that the
properties I'm thinking of aren't there any more.
Or maybe it's only in PostgreSQL that some connection-specific properties
are tied to a result resource?

--
Like Music?
http://l-i-e.com/artists.htm

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация