473,394 Members | 1,722 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

PHP MSSQL connection

How can i connect PHP script to MSSQL server.
May 2 '13 #1

✓ answered by Atli

@afroz ahmad
  1. He's asking about MSSQL (Microsoft SQL Server), not MySQL. Big difference.

  2. The old MySQL API extension, including the mysql_connect and mysql_query functions, is deprecated and should not be used any more. These days you should be using PDO or MySQLi to access MySQL.

  3. The old MSSQL functions, like mssql_connect(), are not available on PHP 5.3 or higher. The SqlSrv extension I mentioned in my previous post should be used instead.

3 1498
Atli
5,058 Expert 4TB
Is the PHP script being executed on a Windows host? If so, I suggest the PDO extension with the PDO_SQLSRV driver, which you can download here, directly from Microsoft.

If it's on a Unix host, the PDO_ODBC or PDO_DBLIB drivers are the two options I would try.
May 2 '13 #2
use

mysql_connect("dbname","username","password")
May 4 '13 #3
Atli
5,058 Expert 4TB
@afroz ahmad
  1. He's asking about MSSQL (Microsoft SQL Server), not MySQL. Big difference.

  2. The old MySQL API extension, including the mysql_connect and mysql_query functions, is deprecated and should not be used any more. These days you should be using PDO or MySQLi to access MySQL.

  3. The old MSSQL functions, like mssql_connect(), are not available on PHP 5.3 or higher. The SqlSrv extension I mentioned in my previous post should be used instead.
May 4 '13 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Antonis Konstantinos | last post by:
Hi all, My Linux (k2.4.13) machine is now working with PHP 4.3.3 with Apache 1.3.28 and Mysql 4.0.15a.. I am now writing a script that connects to a MSSQL v8.0 server. In order to do this I...
7
by: mj | last post by:
Hello, thanks for the help. I am running a WinXP Pro w/ SP2 (my home computer, with ZoneAlarm firewall) Apache 2.0.52 MySQL 4.1.7 PHP 5.1.0-dev I have developed a PHP/MySQL web app that...
2
by: Maniek | last post by:
Hi, Has anyone Pg linked to MSSQL or vice versa? I need to transfer some data MSSQL->PGSQL, but without writing a complex program. Maybe using Linked Server (MSSQL), ODBC / JDBC / OLE DB,...
0
by: dan | last post by:
Hi, I connect to a microsoft SQL server from php. Php is running on linux (debian sarge) with the freetds package. The connection is secured through stunnel (version 3.26), with stunnel running...
3
by: gharmel | last post by:
I'm trying to get some clues on why I get (much) slower responses from my PHP applications when dealing with a remote sql server as opposed to a local sql server. Here's my situation: Server...
2
by: grandmasterneil | last post by:
I have a couple of servers here at work that run IIS, MSSQL, and ASP.NET. I have PHP installed and running via Apache on my laptop. I was wondering if I can run code on my laptop (PHP/Apache)...
7
by: RossM | last post by:
Hey, I am trying to connect to a MSSQL database but i keep getting the error "Compile error: User-defined type not defined". My code is below: Option Explicit Private Sub...
1
by: liquidfirex | last post by:
I have looked at all documentation I can find but still cannot find the answer to my simple question! When connection pooling is enabled, all individual connections still maintain their own SPID...
0
by: menmaatre | last post by:
Hi all, I have a very odd problem: - System A: Win 2k3 with IIS 6 exposing a little WSDL Webservice - System B: Win 2k3 with MSSQL Server 2k5 - System C: RedHat Enterprise Server running...
1
by: newphpcoder | last post by:
Actually, now I only test my webpage in a computer that I create as a server. And also I’m not too familiar in a server. Now I created a database in SQL Server 2005 Express and some of information I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.