Any reasons why this not work? When I print the query to screen and runs it through phpMyAdmin it works. I left out the part where I connect to the database (MySQL).
$query = "START TRANSACTION; ";
$query .= "INSERT INTO table1(text) VALUES('$question_description'); ";
for ($i = 0; $i < count($processed_answers); $i++) {
$query .= "INSERT INTO table2(question_id, text, serial_number, is_correct) ".
"VALUES($question_id, '".$processed_answers[$i]."', '".$serial_numbers[$i]."', 0); ";
}
foreach($categories as $category) {
$query .= "INSERT INTO table3 VALUES($question_id, $category); ";
}
$query .= "COMMIT; ";
$result = $db->query($query);