I’m trying to insert data from php into MSSQL DB.
I’m able to do this:
sqlsrv_query($conn,"insert into <DB_Name> (First_Name,Last_Name) VALUES ('Dani','Yorgen')");
The thing is that i have an array which i want to use it instead of using static values.
i found this command:
$columns = implode(", ", array_values($headers));
this works perfeclty for me!
however when itry to do the same for the data it doesnt come as i want.
the result comes like this:
when i need it to look like this:
thanks in advance.
I managed to find the solution after bashing my head a little bit longer 🙂
it should go like this:
$columns = "'" . implode(",", array_values($headers)) . "'";
hope it will help those who needs.