i have an array that i need to pass to another page and store in a table, so i used serialize to try and accomplish this.... here is my code to do this

$ordered = serialize($_POST['ordered']);

when i do an echo "$ordered"; what comes up is: s:5:"Array";

isnt it supposed to be a list of things stored in the array? what am i doing wrong?

    the problem is that the serialize isnt storing the array as a series of strings, but rather its still storing it as an array.... so when i do the following code:

    $ordered = serialize($_POST['ordered']);
    $total = $_POST['total'];
    echo "$ordered <br>";
    $test = unserialize($ordered);
    echo "$test";
    

    i get the following:
    s:5:"Array";
    Array

    the serialize isnt storing the array properly, i just cannot figure out why... does the table record have to be of any certain type (varchar, text etc) to be able to store serialized arrays properly?

      echo "<pre>".print_r($test, TRUE)."</pre>";
      
        NogDog wrote:
        echo "<pre>".print_r($test, TRUE)."</pre>";
        

        is this a post in the wrong thread by accident? cause if its not, i dont understand at all

          Use print_r() to view the contents of an array. Echoing the array variable will just tell you that it's an array; it won't show you the contents.

            Write a Reply...