Re: Store array into mysql?

From: Date: Thu, 14 Feb 2002 17:41:39 +0000
Subject: Re: Store array into mysql?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-84770@lists.php.net to get a copy of this message
Hi Jan > I have an array called $myarray and now I want to store it in a mysql table. > I tried to just, insert into mytable values('$id', '$myarray') but just got > Array when I run > while ($row = mysql_fetch_array ($result)) > $myarray= $row[myarray]; > echo $myarray > -- > Do I need to first make a string commaseparated or like and than insert that > string? It depends... but don't worry, this is a fairly common assumption, so we can quickly sort it out for you. First some questions: Do you want to fit the elements of the array into successive columns across a single row of the MySQL table, or do you want each of the array elements to be stored into separate rows in the table? Are we talking about a one dimensional array, two, or more? What is the MySQL table schema? Please advise, =dn PS are you aware that there is another PHP discussion list [PHP-DB]?

« previous php.general (#84770) next »