mysqli transaction doesnt work
so, i need to insert data into 2 tables the second needs the autoincremented user_id from table 1 i have turned autocommit to false i believe yet the code only stores the username and password. where ami going wrong? <?php require_once ("encrypt.php"); $conn = mysqli_connect($servername, $dbuser, $dbpassword, $dbname); $problem = ''; $firstName = $_SESSION['firstName'] ; $lastName = $_SESSION['lastName']; $email = $_SESSION['email']; $username= $_SESSION['username']; $password= $_SESSION['password']; $pass = encrypt($password); if(isset($_POST["mysubmit"]) && ($_POST["mysubmit"]=="Submit Form")){ $eventDate = mysqli_real_escape_string ($conn, $_POST["eventDate"]); $difficultyCatagory = mysqli_real_escape_string ($conn, $_POST ["difficultyCatagory"]); $clubSelect = mysqli_real_escape_string ($conn,$_POST["clubSelect"]); echo $eventDate, $difficultyCatagory, $clubSelect, $firstName, $lastName, $email, $username,$password; if ($problem == ''){ mysqli_autocommit($conn,FALSE); mysqli_query ($conn,"INSERT INTO userBMX (username,password) VALUES ('$username', '$pass')"); mysqli_query ($conn,"INSERT INTO userDetailsBMX (userID , firstName, lastName, email, dateofBirth, Status, club) VALUES (last_insert_id(), $firstName, $lastName, $email, $eventDate, $difficultyCatagory, $clubSelect)"); mysqli_commit($conn); mysqli_close($conn); echo 'stored'; } else{ echo "ERROR: was not able to execute $conn. " . mysqli_error($conn); } } ?>