Quantcast
Channel: Microsoft Drivers for PHP for SQL Server forum
Viewing all articles
Browse latest Browse all 391

PHP and Inserting data from Web Form to SQL Server Express

$
0
0

I have somewhat thrown this together from what I have seen on the internet.  Not at all savvy with PHP.  Little SQL Server knowledge, but not much.  I have this code created:

<?php
$serverName = 'SRB-Nick_Desktop\sqlexpress';
$connectionInfo = array('cslogs', 'cslogslogin', '123456');
$conn = sqlsrv_connect($serverName, $connectionInfo);

if( $conn === false )
{
     echo "Connection could not be established.\n";
     die( print_r( sqlsrv_errors(), true));
}

$tsql = "INSERT INTO tbl.logs(ForteID, disposition, appnumber, fin_number, num_payments, ach_cc, date, notes) VALUES ('$ForteID' , '$disposition' , '$appnumber' , '$fin_number' , '$num_payments' , '$ach_cc' ,'$date' , '$notes')";

$params1 = array( 1, 1 );

$query = sqlsvr_query( $conn, $tsql1, $params1);

if( $query )
{
     echo "Row successfully inserted.\n";
}
else
{
     echo "Row insertion failed.\n";
     die( print_r( sqlsrv_errors(), true));
}

sqlsvr_close($conn);

/* header('Location: thanks.htm');
exit(); */
?>

And then when I go to the web page that has this code in it I get this error:

( ! ) Fatal error: Call to undefined function sqlsrv_connect() in C:\wamp\www\cslogs\csform.php on line 4

What am I doing wrong?




Viewing all articles
Browse latest Browse all 391

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>