SHARE
TWEET

Untitled

a guest Oct 4th, 2017 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $myServer = ".SQLEXPRESS";
  2.     $myUser = "sa";
  3.     $myPass = "blablabla";
  4.     $myDB = "test";
  5.  
  6.     //connection to the database
  7.     $dbhandle = mssql_connect($myServer, $myUser, $myPass)
  8.       or die("Couldn't connect to SQL Server on $myServer");
  9.  
  10.     //select a database to work with
  11.     $selected = mssql_select_db($myDB, $dbhandle)
  12.       or die("Couldn't open database $myDB");
  13.  
  14.     //declare the SQL statement that will query the database
  15.     $query = "SELECT * FROM dbo.table WHERE query='2'";
  16.     //$query .= "FROM dbo.table  ";
  17.     //$query .= "WHERE query='2'";
  18.  
  19.     //execute the SQL query and return records
  20.     $result = mssql_query($query);
  21.  
  22.     $numRows = mssql_num_rows($result);
  23.     echo "<h1>" . $numRows . " Row" . ($numRows == 1 ? "" : "s") . " Returned </h1>";
  24.  
  25.     //display the results
  26.     while($row = mssql_fetch_array($result))
  27.     {
  28.       echo "<li>" . $row["query"]. "</li>";
  29.     }
  30.     //close the connection
  31.     mssql_close($dbhandle);
  32.    
  33. [global]
  34. ;tds version = 4.2
  35. tds version = 8.0
  36. client charset = UTF-8
  37.    
  38. mssql.charset = "UTF-8"
  39.    
  40. sudo apt-get install php-sybase
  41.    
  42. ...
  43. [global]
  44.     # TDS protocol version
  45. ;   tds version = 4.2
  46. tds version = 8.0
  47. client charset = UTF-8
  48. ...
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top