Re: Storing an array in the database

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> > How would I store an array in the database?  I want to store 2 things.
> > One array of shirt sizes and one array of which holds other arrays.
[snip]
>   $query = "INSERT INTO table
>                  ( field1, field2 )
>                  VALUES
>                  ( \"" . serialize( $singleDimArray ) . "\", \"" .
serialize( $multiDimArray ) . "\" )";

FYI: Make sure you addslashes() _after_ you serialize your array if it can
contain quotes. Everything else remains the same.

---John Holmes...


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux