Hi I am out of ideas on why is php prompting me this error.
I have tested my codes in MS SQL and I am able to execute the following codes without any issues.
INSERT INTO MEMB_INFO
(memb___id, memb__pwd, memb_name, sno__numb, bloc_code, ctl1_code)
VALUES('test', '12345678', 'test', '1111111111111', '0', '0');
However when going back to my PHP I tried to execute the code through sqlsrv_query(), it doesn't work.
I am able to retrieve data through my PHP thus I can verify that my connection has been establish.
This is the code that is prompting me the error.
<?php
try
{
$conn = new PDO("sqlsrv:Server=127.0.0.1,1433;Database=MyPhpDB", "sa", 'password');
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
catch(Exception $e)
{
die(print_r($e->getMessage()));
}
$sql = "INSERT INTO MEMB_INFO
(memb___id, memb__pwd, memb_name, sno__numb, bloc_code, ctl1_code)
VALUES(?, ?, ?, ?, ?, ?);";
$params = array('test3', '12345678', 'test3', '1111111111111', '0', '0');
$stmt = sqlsrv_query($conn, $sql, $params);
if( $stmt === false ) {
die( print_r( sqlsrv_errors(), true));
}
sqlsrv_close($conn);
?>
any help is greatly appreciated!! thank you.