deepPHP Posted August 15, 2013 Share Posted August 15, 2013 I insert big data into database hence those data should be compressed for memory less. I compress those data with base64, gzcompress and serialize the data. but when I want to select all my data records I'm getting decompressing error. unserialize(): Error at offset 0 of 796 bytes I inserted data in that order: base64_encode(gzcompress(serialize($data); I selcet data in the opposite order: base64_decode(gzuncompress(unserialize($data); Link to comment https://forums.phpfreaks.com/topic/281186-decompressing-problem/ Share on other sites More sharing options...
0xMatt Posted August 15, 2013 Share Posted August 15, 2013 Not only should you have used the opposite functions but you should have called them oppositely as well. <?php $array = array('one','two','three'); $compressed = base64_encode( gzcompress( serialize($array) ) ); $uncompressed = unserialize( gzuncompress( base64_decode($compressed) ) ); print_r($uncompressed); // prints Array ( [0] => one [1] => two [2] => three Link to comment https://forums.phpfreaks.com/topic/281186-decompressing-problem/#findComment-1445109 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.