Re: Create Mysql Records From a Comma separated Values String

From: Date: Wed, 06 Feb 2002 23:40:53 +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-83784@lists.php.net to get a copy of this message
The function you are looking for is 'explode'. It works like this, say you have a line of text stored in line of say pizza topping like this: $pizza_toppings = "topping1,topping2,topping3" and now you want the toppings in an array just do this: $toppings = explode(",", $pizza_toppings); then you will have an array $toppings with entries for each of the toppings. Hope this helps. Ben Simos Varelakis wrote: > 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

« previous php.general (#83784) next »