Sorry i'm a total noobie to PHP having spent years on ASP
i am trying to connect and post into an MSSQL database and whilst i seem to be able to connect ok and do not get any errors - nothing goes into the database
my code is:
<?php
print "Hello world!";
$name = 'andy';
echo $name;
$serverName = "*******";
$connectionInfo = array( "Database"=>"TEST_PHP", "UID"=>"sa", "PWD"=>"*******");
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn ) {
echo "Connection established.<br />";
}else{
echo "Connection could not be established.<br />";
die( print_r( sqlsrv_errors(), true));
}
$query = mssql_query("INSERT INTO TBL_PHP (NAME) VALUES ('$name')");
mssql_query($query) or die ('Error Updatating Database');
?>
I get the 'Connection established' fine and i also get the echo bit displaying 'Andy' fine - nothing else is on the page and there is nothing posted into the database
can someone see where i am obviously going wrong
thanks