I am very new to SQL/Access, and only use it very limitedly, so
apologies
ahead of time.
I have a website that inserts data into an access database, using the
code
below. Basically, I've got one INSERT INTO statement that inserts
one
line of data into one database, and and then a php for loop that
inserts multiple lines into a database with successive INSERT INTO
statements. The for loop seems to work fine, but $statement1
sporadically fails to insert data properly into the database-- eg,
for
one of the values, it'll spontaneously not insert all characters. At
times, the $statement1 fails to insert into the database completely.
Any suggestion? Again, I'm not a programmer and particularly not
used
to SQL, so if anyone responds, please keep it simple! Thanks!
Laura
<?
$odbc = ODBC_CONNECT('user','root','password') or die
(odbc_errormsg('Could not connect to requested data source'));
$statement1 = odbc_exec($odbc,"INSERT INTO
database1(user,sessiondate,test,score1,score2,scor e3,score4,score5)
VALUES
('$username','$date','$expName','$score1','$score2 ','$score3','$score4','$s*
core5')");
for ($i=0;$i<sizeof($lbl);$i++) {
$foo = explode(" ",$lbl[$i]);
$statement2 = odbc_exec($odbc,"INSERT INTO
database2(i,user,sessiondate,stimdone,response,tri aldur,acc,status)
VALUES
('$foo[0]','$username','$date','$foo[1]','$foo[2]','$foo[3]','$foo[4]','$fo*
o[5]')");
}
odbc_close($odbc);
?>