Verification: a143cc29221c9be0

Mysql для php sql server

Example MS SQL Server Setup

We were able to set up MS SQL Server 2005 Express (free download) and connect to it via PHP by the following steps. There are several versions of MS SQL Server, so additional configuration may be required for other versions.

  1. Install MS SQL Server 2005 Express.
  2. Set up a database and table.
  3. Set up a SQL user.
  4. Enable Mixed Authentication.
  5. Add permissions on the database for the created user.
  6. Add permissions on the table for the created user.
  7. Access the Server according to the steps outlined below.

Connecting to a MS SQL Server database with PHP

Connecting to a MS SQL Server database with PHP is very similar to connecting to a MySQL database. The following example demonstrates how to connect to a MS SQL database from PHP. Note that the function names contain mssql, not mysql.


$host ="xxx.xxx.xxx.xxx"; 
$username ="username";
$password ="password";
$database ="database";

mssql_connect($host, $username, $password);
mssql_select_db($database);
?>