Hi all,
I'm new to the list. I looked a bit through the archives and couldn't
find an answer to my problem that addressed it in a way that helped me,
so I'm going to phrase it here.
I'm working on a PHP script that will take input and create several
table rows in mySQL based on this input.
Basically we have a generic form with many plain variables being passed
to the script.
The script is supposed to take the last several variables, make an
array, and with a foreach() statement, create table rows for each entry
in the array.
Example:
Var1 = "John Doe"
Var2 = "345 test dr."
var3 = "Test City"
var4 = "Test state"
var5 = "Test Zip"
etc
var6 = "cars"
var7 = "boats"
var8 = "planes"
$var_array = (cars, boats, planes)
foreach ($var_array as $value) {
$sql = "INSERT into db.table (var1, var2, var3, var4, var5, var6)
VALUES ('$var1', '$var2', '$var3', '$var4', '$var5', '$value');
$result = mysql_query($sql)
or die ("Unable to execute query.");
}
it will do the first one in the array, and error out on the 2nd..
consistently... ??
Is there something with this one I'm just not understanding, like a
problem with mySQL not wanting to do almost identical queries right
after each other..?
Also I can't figure out how to setup the mySQL query log, so that I can
find out what exactly is happening step by step, I've tried coding in as
much error logging as I can in the script, but it stops short here and I
can't find anything else out...
help?
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php