I'm trying to input multiple queries guys using mysqli. Yet it's not populating the database. Any ideas?
$q2="UPDATE ticketinfo SET ticketstatus = $status where ticketno = $ticket;
insert into ticketinfo (remarks) values ('$remarks')";
$ex2= mysqli_multi_query($conn,$q2);
SQL queries should be executed sequentially. Never use
mysqli_multi_query()with variable input. You should be using parameterized prepared statements. There is hardly any use case formysqli_multi_query()at all.Your code should look like this:
I used two prepared statements and bound the input separately. This much better, cleaner and safer option than
mysqli_multi_query().