[PHP-WIN] Re: Store array in mysql?

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

 



use "serialize".

you need to create a table with 2 fields, key & value, where value is a
largetext field.

$str = serialize($array);
mysql_query("insert into table1 (key, value) as ($key, $str)");

then you can select it back out of mysql and use

$result = mysql_query("select....");
$array = unserialize($result[0]->value);

pardon if the php doesn't work, i'm just typing it off the top of my head

"Disko_kex" <disko_kex@swedish-mushroom.com> wrote in message
000001c367ec$f7b28340$e900a8c0@lokalguirdcfee">news:000001c367ec$f7b28340$e900a8c0@lokalguirdcfee...
> If I have a normal array like "Array ( [0] => 1 [1] => 3 [2] => 82 )" ,
> and want to store the array in a mysql table and then want to use it.
> How can I do?
>
> // jocke
>


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


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux