i am need to create one email adding program., so i am using the code.. $sql="INSERT INTO $tbl_name(email)VALUES('$email')"; $result=mysql_query($sql); PHP: But this adding successfully but only one email id at a time but i need add more than one separated with commas..., Example: , ,............. Any body help me regarding this...!
http://www.brainbell.com/tutorials/MySQL/Inserting_Multiple_Rows.htm $sql = "INSERT INTO $tbl_name (email) VALUES ('someone@example.com'), ('someoneelse@example.com'), ('yetanother@example.com')"; PHP:
$email_addresses = "abcd@testing.com, efgh@testing.com, ijkl@testing.com"; $sql = "insert into $tbl_name (email) values('" . join("'), ('", preg_split('/\s*,\s*/', $email_addresses)) . "')"; $result = mysql_query($sql); PHP: Untested but should work.
hello JAY6390, your vision is correct but, i am posting those emails, i mean once i add the email on del.php, and i press the button delete then that email is post to delmail.php then the program is: $sql="INSERT INTO $tbl_name(email)VALUES('$email')"; $result=mysql_query($sql); When i add emails with commas in del.php, then ???
hello SmallPotatoes, thanks a lot yours is working.... 100% Any way thanks SmallPotatoes & JAY6390. i got finally
i am successfully adding multiple emails though your code: $email_addresses = "abcd@testing.com, efgh@testing.com, ijkl@testing.com"; $sql = "insert into $tbl_name (email) values('" . join("'), ('", preg_split('/\s*,\s*/', $email_addresses)) . "')"; $result = mysql_query($sql); PHP: Same time can you help me regarding the deleting too.