I need to send data to the SQL Server from a HTML form using PHP. The script to open the connection works, but being SQL Server not MySQL it's a bit hard to find a good example to INSERT data into the table.
Tried several methods, but none works. Some examples:
<?php
$query = "
INSERT INTO dbo.facturi_achizitii
(tip, MBxxx, xxx_key, Document, Reference, doc_xxx_text, doc_date, xxx_date, Customer, Business_xxx, xxx_jurnal, valoare_xxx, tax_b_amount, output_xxx)
VALUES
('$tip', '$MBxxx', '$xxx_key', '$Document', '$Reference', '$doc_xxx_text', '$doc_date', '$xxx_date', '$Customer', '$Business_xxx', '$xxx_jurnal', '$valoare_xxx', '$tax_b_amount', '$output_xxx')";
$params1 = array($tip, $MBxxx,$xxx_key, $Reference, $doc_xxx_text, $xxx_date, $xxx_date, $Customer, $Business_xxx, $xxx_jurnal, $valoare_xxx, $tax_b_amount, $output_xxx);
$stmt = sqlsrv_query( $conn, $sql, $params);
if( $stmt === false ) {
die( print_r( sqlsrv_errors(), true));
}
?>
What is wrong with it? Thank you