Over MySQLi I would do:
$sql = $connect->prepare("INSERT INTO Table (a, b) VALUES (?, ?)");
$sql->bind_param('ss', $a, $b);
$sql->execute();
$sql->close();
Now the question is, how I do the same thing with mssql for a SQL Server instead of MySQL?
I know I could do:
$sql = sqlsrv_query($connect, "INSERT INTO Table (a, b) VALUES (?, ?)", array($a, $b));
However, this requires the SQL Drivers specific for windows, which I cannot use over a linux platform (where in fact my website is hosted).
My server has however the mssql library installed, and even if it's deprecated, still it work pretty good with PHP 5.6
I have troubles on parameterizing the queries though, all I could do is:
$sql = "INSERT INTO Table (a, b) VALUES ('$a', '$b')";
mssql_query($sql, $connect);
But of course I do not want to directly insert the values, so how I can parameterize that query on mssql?