Skip to content

Instantly share code, notes, and snippets.

@v-mabarw
Created July 29, 2014 22:42
Show Gist options
  • Save v-mabarw/bd189ad8ac04f5a59717 to your computer and use it in GitHub Desktop.
Save v-mabarw/bd189ad8ac04f5a59717 to your computer and use it in GitHub Desktop.
CodePlex Issue #22418 Plain Text Attachments
<?php
$connectionInfo = array( "Database"=>"Knowledgeroot2", "UID"=>"sa", "PWD"=>"Integra4711");
$conn = sqlsrv_connect( "WIN-3U11NKJ7P3U\SQLEXPRESS", $connectionInfo);
$sql = 'INSERT INTO "content" ("parent", "name", "content", "created_by", "changed_by", "create_date", "change_date") VALUES (?, ?, ?, ?, ?, ?, ?) SELECT SCOPE_IDENTITY() as Current_Identity';
$params = array(1, 'TTTTTTTTTTTTT', 'TTTTTTTTTTTTT', 0, 0, '20121128 20:01:57', '20121128 20:01:57');
$stmt = sqlsrv_query( $conn, $sql, $params);
if( $stmt === false ) {
die( print_r( sqlsrv_errors(), true));
}
// Make the first (and in this case, only) row of the result set available for reading.
$next_result = sqlsrv_next_result($stmt);
$next_result = sqlsrv_next_result($stmt);
if( sqlsrv_fetch( $stmt ) === false) {
die( print_r( sqlsrv_errors(), true));
}
// Get the row fields. Field indeces start at 0 and must be retrieved in order.
// Retrieving row fields by name is not supported by sqlsrv_get_field.
$name = sqlsrv_get_field( $stmt, 0);
echo "$name: ";
echo "jojo";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment