Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $myServer = ".SQLEXPRESS";
- $myUser = "sa";
- $myPass = "blablabla";
- $myDB = "test";
- //connection to the database
- $dbhandle = mssql_connect($myServer, $myUser, $myPass)
- or die("Couldn't connect to SQL Server on $myServer");
- //select a database to work with
- $selected = mssql_select_db($myDB, $dbhandle)
- or die("Couldn't open database $myDB");
- //declare the SQL statement that will query the database
- $query = "SELECT * FROM dbo.table WHERE query='2'";
- //$query .= "FROM dbo.table ";
- //$query .= "WHERE query='2'";
- //execute the SQL query and return records
- $result = mssql_query($query);
- $numRows = mssql_num_rows($result);
- echo "<h1>" . $numRows . " Row" . ($numRows == 1 ? "" : "s") . " Returned </h1>";
- //display the results
- while($row = mssql_fetch_array($result))
- {
- echo "<li>" . $row["query"]. "</li>";
- }
- //close the connection
- mssql_close($dbhandle);
- [global]
- ;tds version = 4.2
- tds version = 8.0
- client charset = UTF-8
- mssql.charset = "UTF-8"
- sudo apt-get install php-sybase
- ...
- [global]
- # TDS protocol version
- ; tds version = 4.2
- tds version = 8.0
- client charset = UTF-8
- ...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement