Reputation: 837
my serialized data looks like this
a:6:{i:0;s:12:"Early humans";i:1;s:32:"Apes And Hominids Dart's Find";i:2;s:36:"The hunter gatherers of South Africa";i:3;s:25:"Early Humans The Eve Gene";i:4;s:50:"Australopithecines, Homo ergaster and Homo sapiens";i:5;s:21:"Landscapes of history";}
When i try and unserialize, it turns out to be empty.
my code:
$urlnames = unserialize($row['url_name']);
foreach($urlnames as $names){
echo $name;
}
What am I doing wrong?
Thanks
Upvotes: 3
Views: 5328
Reputation: 73
Did you get your serialized string form the db?
If you get it from there, than your backslash is missing. That's your 32th character.
more info about backslashes and databases check google/yahoo/bing ...
Upvotes: 1
Reputation: 73
On index 1 you have only 31 characters that's why it isn't working.
Upvotes: 1
Reputation: 437336
The serialized string is wrong. There should be one more character in the "Dart's find" string -- I don't know why one is missing, but adding one will make it work fine.
Upvotes: 4