The trick here is to do some debugging :)
Firstly make sure that your error reporting level is set to E_ALL in
php.ini - then you've got some chance of seeing error and warning messages.
Secondly, while there are probably loads of ways of doing what you are
trying to do, all the correct ones will check the return value from ALL the
mysql calls. The mysql functions return 0 if something went wrong. There's
absolutely no point carrying on to the next stage since when you pass the 0
into the next stage it will just complain (if your error reporting level is
set high enough) - it simply can't do the next bit with a connection or
result handle of 0.
So, for each mysql call do something like:
$Thingy = mysql_whatnot(blah) or die('it went wrong doing whatnot, mysql
says '.mysql_error());
and if that doesn't give you the clue you need (which it will 99% of the
time, echo out the SQL statement and see if that looks silly in any way.
Good luck.
--
Phil Driscoll
Dial Solutions
+44 (0)113 294 5112
http://www.dialsolutions.com
http://www.dtonline.org
-----Original Message-----
From: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Date: Friday, March 09, 2001 12:31 PM
Subject: [PHP] Multiple Inserts
>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="[EMAIL PROTECTED], [EMAIL PROTECTED]";
>
><?
>// 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
=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($SQLState
ment);
>
>}
>
>?>
>
>Anyone know what might be going wrong, or perhaps I have the wrong method?
>
>Thanks
>Ade
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]