Home » questions » How do i connect to SQL server with PHP?

How do i connect to SQL server with PHP?

2006-08-13 22:46:11, Category: Programming & Design
My pages run 100% ok on linux, but i need to use an SQL database and retain my PHP. This will probably run on a windows server. Someone give me the connection script for this. My pages run 100% ok on linux, but i need to use MSSQL database and retain my PHP. This will probably run on a windows server. Someone give me the connection script for this.

Answers

  1. Arya

    On 2006-08-14 01:11:29


    If you have to connect to database in server you can use this script: $connection=mssql_connect ($host, $username, $password); But if you have to connect to the local host: you should download Zip Package From this site(depends on php version): http://www.php.net/downloads.php and copy php_mssql.dll file to winnt\system32 and you should configure php.ini file by adding extension=php_mssql.dll
  2. James

    On 2006-08-13 22:58:54


    here's the code: mysql_connect("hostname", "username","password"); the username and password are optional, i think. use this to connect to the database, i assume you already know this: mysql_select_db("dbname");
  3. muoreh

    On 2006-08-13 22:53:37


    what kind of SQL? if you meant MSSQL, here's how... $conn=mssql_connect ($servername, $username, $password);
  4. YoUnG MilLiOnAirE

    On 2006-08-13 23:16:23


    sry are you talking about this ?
  5. kryptonboy22

    On 2006-08-13 22:52:02


    you might see the answer here: www.w3schools.com