Serialized data in mysql database needs to combined in an array

前端 未结 2 456
耶瑟儿~
耶瑟儿~ 2021-01-28 02:02

I am working in PHP/MySQL.

I have a table in my database called hourly in that table their is a column named webaddress these are serialized. There are multiple rows of

2条回答
  •  故里飘歌
    2021-01-28 02:10

    change it to $test[] = unserialize($row[0]).

    It will unserialize your data into an array, and then push that array into the $test array. To see how it looks, after your loop, add this line:

    print_r($test);
    

    It will be something like this:

    array(
        [0] => array(
            // ... the first record's data
        ),
        [1] => array(
            // ... the second record's data
        ),
        // etc
    )
    

提交回复
热议问题