I am a total newbie with php and mysql and I have a problem with how to put a variable in an array. What I'm trying to do is getting $data[$i] to work. Here's the snippet of code I have here that is not working. I know it is bad style but I'm in a hurry and just want to know how to get $data[$i] working.
Code: Select all
for ($i = 0; $i < 31; $i += 1){
$sql_insert = "INSERT INTO med_log (`user_id`, `date`, `med1`,`dose1`, `transfusion`)
VALUES ('$_SESSION[user_id]', '2010-11-01' , '$data[med1_{$i}]', '$daydose1[{$i}]', '$data[transfusion_{$i}]')";
mysql_query($sql_insert) or die(mysql_error());
}