August 7th, 2000, 10:59 AM
I use a form to collect emailadresses (form name=email) and the idea is that you can enter multiple adresses comma seperated.
Now my question is, how do I split the emailadresses and put them seperated in my dbase. I know I have to use (some of) the commands mentioned in the topic, but I couldn't find any good example that made me understand how it works...
August 7th, 2000, 11:35 AM
how do I split the emailadresses and put them seperated in my dbase.
You can use explode() function for this..
try something like this...
//seperate the values based on "," and put it in an array..
// now you can insert the value into the database..
mysql_query("INSERT INTO tablename(email) values('$email_values[$a]')";
//insert the emaiils..
"The fear of the LORD is the beginning of knowledge..."
[This message has been edited by Shiju Rajan (edited August 07, 2000).]
August 7th, 2000, 05:57 PM
the only difference (as far as I can tell) between explode() and split() is that explode uses less overheads as you cannot specify regexps in them, I may be wrong on this though
something like this shows how explode is really cool
$random_incoming_string = "myname,myaddress,mytel,myemail";
list($name,$address,$telephone,$email) = explode(",",$random_incoming_string);
August 8th, 2000, 12:49 AM
You are right. split() uses regexps and is a little slower. explode() doen't. For this use, explode() is perfect...
August 8th, 2000, 04:52 AM