The Arcive of vBulletin Modifications Site. |
|
|
The joys of serializing data
To serialize a variable or object in PHP means to take the variable or object and convert it to a string that can be stored anywhere, including, relevant to vB, a MySQL database. Later, it can be unserialized, at which point it'll be (nearly) exactly the same as when it was serialized. An example: PHP Code:
Reference: http://www.php.net/serialize http://www.php.net/unserialize (way faster than serializing) |
|
#2
|
|||
|
|||
|
Note that you can't serialize resources (such as a mysql connection) so the example posted won't work.
|
|
#3
|
|||
|
|||
|
The example itself should work, though, because $DB_site is just an object that never stores a result handle (at least not permanently).
|
|
#4
|
|||
|
|||
|
Quote:
![]() $query_id can't be serialized either. In order to run $DB_site->query(), $link_id has to be a valid MySQL connection resource. |
|
#5
|
|||
|
|||
|
Oh, good point
![]() But the concept is there
|
|
#6
|
||||
|
||||
|
Great! A thread on serializing.
![]() I'm just starting to learn this. Maybe you can answer this question, filburt. How do we determine this when making the query for the datstore? PHP Code:
|
|
#7
|
||||
|
||||
|
s(tring)
Length)1 Value)"0";s(tring) Length)14 Value)"getthreadviews";I'd guess. |
|
#8
|
||||
|
||||
|
Why would you need 2 string lengths in there?
|
|
#9
|
||||
|
||||
|
PHP Code:
|
|
#10
|
||||
|
||||
|
Ahhh, ok, now I understand.
![]() Thank you, sir.
|
![]() |
|
|