Re: Create Mysql Records From a Comma separated Values String
| From: | Edward van Bilderbeek - Bean IT | Date: | Wed, 06 Feb 2002 12:54:52 +0000 |
| Subject: | Re: Create Mysql Records From a Comma separated Values String | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-83701@lists.php.net to get a copy of this message | ||
$array_foo = explode(",", $foo);
for ($i=0; $i<count($array_foo); $i++) {
mysql_query("INSERT INTO table VALUES (" . $array_foo[$i] . ")");
}
Greets,
Edward
----- Original Message -----
From: "Simos Varelakis" <simos@athenatours.gr>
To: <php-general@lists.php.net>
Sent: Wednesday, February 06, 2002 1:54 PM
Subject: [PHP] Create Mysql Records From a Comma separated Values String
>
> Hi to everyone
>
> i have the following problem
>
> i have a string $foo which contains (n variable) comma separated values
> (example "1,17,23,45")
> and i want to insert these values in a mysql table . The destination field
> is int type and i need to insert one record per value
>
> Do you know which php function(s) should i use in order to (loop -extract
> the values from string) and do that ??
>
> Thanks in advance for your help
>
> regars
>
> simos
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>