[PHP] Create Mysql Records From a Comma separated Values String

2002-02-06 Thread Simos Varelakis


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




Re: [PHP] Create Mysql Records From a Comma separated Values String

2002-02-06 Thread Edward van Bilderbeek - Bean IT

$array_foo = explode(,, $foo);

for ($i=0; $icount($array_foo); $i++) {
mysql_query(INSERT INTO table VALUES ( . $array_foo[$i] . ));
}

Greets,

Edward


- Original Message -
From: Simos Varelakis [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
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




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