Multiple Inserts

From: Date: Fri, 09 Mar 2001 12:29:25 +0000
Subject: Multiple Inserts
Groups: php.general 
Request: Send a blank email to php-general+get-43134@lists.php.net to get a copy of this message
Hi, I am trying to do some multiple inserts using the following code but it doesn`t seem to work, it inserts the first one but then the second is inserted as blank. Where the value being passed is $Emails="test@test.com, test1@test.com"; <? // Get Login info require("blah..."); // Connect to MySQL $connection=mysql_connect($host, $user, $pass); // Format the Emails $Emails1=str_replace(" ","",$Emails); $GetEmails=explode(",",$Emails1); // Insert into Members Database for ($a=0;$a<count($GetEmails);$a++){ $SQLStatement = "INSERT INTO Members (Email) VALUES ('".$GetEmails[$a] ."')" or die ("Problem"); $db = mysql_select_db($dbase, $connection); $SQLResult = mysql_query($SQLStatement); } ?> Anyone know what might be going wrong, or perhaps I have the wrong method? Thanks Ade

« previous php.general (#43134) next »