Hello I have this query where I want to insert some data and I have a foreign key I want it to be inserted from the other table because of its a primary key there
here’s my code:
$con = new mysqli("localhost", "root", "", "company"); $st = $con->prepare("INSERT INTO reservations(customer_id,players_number,res_date) VALUES(?,?,?)"); $st->bind_param("iii", $_POST["players_number"], $_POST["res_date"], $_GET["id"]); $st->execute(); header('Location: http://localhost/tech/calendar.php');
the table I want to insert to is called reservations and the customer_id must come from the customer’s table where there it’s the primary key
and I have a form under this code which leads to the same page to get to the code above
Thanks in advance!
when I go to the calendar of the customer I have this url
when I press the add reservation button it has the id in the url using $_GET method
This is the error I get:
I’m sorry if it’s not a very clear question but I’m new to this and doing my Internship with lots of tasks where i got to the point of desperate!!