Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $serverName = 'SRB-Nick_DesktopSQLEXPRESS';
- $connectionInfo = array('Database'=>'cslogs', 'UID'=>'cslogslogin',
- 'PWD'=>'123456');
- $connection = sqlsrv_connect($serverName, $connectionInfo);
- if( $connection === false )
- {
- echo "Connection could not be established.n";
- die( print_r( sqlsrv_errors(), true));
- }
- $tsql = "INSERT INTO logs(ForteID, disposition, appnumber, Finance_Num,
- num_payments, ach_cc, date, notes) VALUES (?,?,?,?,?,?,?,?)";
- $parameters = array( "forteid", "LOC", "NCXXXXXXX4", "SRB-000004", "0",
- "cc", "2012-11-01", "gave LOC instructions");
- $stmt = sqlsrv_query($connection, $tsql, $parameters);
- if( $stmt === false ){
- echo "Statement could not be executed.n";
- die( print_r( sqlsrv_errors(), true));
- }
- else
- {
- echo "Rows affected: ".sqlsrv_rows_affected( $stmt )."n";
- }
- sqlsrv_free_stmt( $stmt);
- sqlsrv_close( $connection);
- ?>
- <?php
- $servername = "localhost";
- $username = "username";
- $password = "password";
- $dbname = "myDB";
- // Create connection
- $conn = sqlsrv_connect($servername, $username, $password, $dbname);
- // Check connection
- if (!$conn) {
- die("Connection failed: " . sqlsrv_errors());
- }
- $sql = "INSERT INTO MyGuests (firstname, lastname, email)
- VALUES ('John', 'Doe', 'john@example.com')";
- if (sqlsrv_query($conn, $sql)) {
- echo "New record created successfully";
- } else {
- echo "Error: " . $sql . "<br>" . sqlsrv_errors($conn);
- }
- sqlsrv_close($conn);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement