The following code is used to insert values into my mysql-database. The "$statement2" is used when a certain account is logged in to my website and works correctly. My problem is, even before I added the second statement-part, that the command "execute();" does not work. I'm using the JS-console.log in order to see where in my program it stops and by using that I found out that my problem was with the execute()-command. I can verify that my code to connect to the database is correct and that my server for the database is running. The variables from my HTML-form are also correct and the querys are correct if put in the console (when changing the variables to actual values).
Does anybody know any fixes?
<?php
if(isset($_POST['submitRapport'])){
?>
<script> console.log("test") </script> <?php
$query = "INSERT INTO tblaccounts(accountid, username, 'password')
VALUES(:säljarid, :username, :'password')";
$query2 = "INSERT INTO tblSeller(sellerid,'status')
values(:sellerid, :'status')";
$statement=$connect->prepare($query);
$statement->bindValue(':sellerid', $_POST['sellerid']);
$statement->bindValue(':username', $_POST['username']);
$statement->bindValue(':password',$_POST['password']);
$statement2 = $connect->prepare($query2);
$statement2->bindValue(':status',$_POST['status']);
?>
<script> console.log("test2") </script> <?php
$statement2->execute();
$statement->execute();
$success = true;
?>
<script> console.log("test3") </script> <?php
}
?>