The problem is that I'm not really totally across array's and I'm trying to take variables submitted in a form and UPDATE several rows in my database with data.
Unfortunately the code I have written only seems to submit empty data into the tables and I can't see why. Ive struggled with this for a while and I wonder if I'm doing something really obviously stupid and just can't see it.
There are lots of text fields in the form I am sending to this script called driver1, driver2 etc and I am loading them into an array in order to be able to insert them one by one into the database.
Anyway, here's the code:
Code: Select all
<?
// includes
include("../conf.php");
include("../nav.txt");
$driverName = array ($driver1,$driver2,$driver3,$driver4,$driver5,$driver6,$driver7,$driver8,$driver9,$driver10,$driver11,$driver12,$driver13,$driver14,$driver15,$driver16,$driver17,$driver18,$driver19);
$pName = array ($p1,$p2,$p3,$p4,$p5,$p6,$p7,$p8,$p9,$p10,$p11,$p12,$p13,$p14,$p15,$p16,$p17,$p18,$p19);
$qName = array ($q1,$q2,$q3,$q4,$q5,$q6,$q7,$q8,$q9,$q10,$q11,$q12,$q13,$q14,$q15,$q16,$q17,$q18,$q19);
$chassisName = array ($c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8,$c9,$c10,$c11,$c12,$c13,$c14,$c15,$c16,$c17,$c18,$c19);
$timediffName = array ($t1,$t2,$t3,$t4,$t5,$t6,$t7,$t8,$t9,$t10,$t11,$t12,$t13,$t14,$t15,$t16,$t17,$t18,$t19);
$lapsName = array ($l1,$l2,$l3,$l4,$l5,$l6,$l7,$l8,$l9,$l10,$l11,$l12,$l13,$l14,$l15,$l16,$l17,$l18,$l19);
$pointsName = array ($pts1,$pts2,$pts3,$pts4,$pts5,$pts6,$pts7,$pts8,$pts9,$pts10,$pts11,$pts12,$pts13,$pts14,$pts15,$pts16,$pts17,$pts18,$pts19);
$increment = 1;
while ($increment <19)
{
$query = "UPDATE results SET racename = '$racename', round = '$round', series = '$series', division = '$division', date = '$date', driver = '$driverNameї$increment]', position ='$pNameї$increment]', qualify = '$qNameї$increment]', chassis = '$chassisNameї$increment]', timediff = '$timediffNameї$increment]', no_laps = '$lapsNameї$increment]', points = '$pointNameї$increment]', timestamp = NOW() WHERE position = '$increment' AND racename = '$racename' ";
$result = mysql_query($query) or die ("Error in query: $query. " . mysql_error());
$increment++;
}
echo "Results updated in the database!";
?>