Jump to content


PHP connection to SQL SERVER 2000?

  • Please log in to reply
3 replies to this topic

#1 Yohanne


    Advanced Member

  • Members
  • PipPipPip
  • 200 posts

Posted 20 February 2014 - 09:04 AM

Hi everyOne.


im done using mysql connection with this code: 

	define ('DB_SERVER_', 'localhost');
	define ('DB_USER_', 'root');
	define ('DB_PASS_', '');
	define ('DB_NAME_', 'protondb');
	class connection
			function __construct()
					$Conn = mysql_connect(DB_SERVER_, DB_USER_, DB_PASS_) or die("Server not Conneceted -> $Conn". sha1(mysql_error()));
							mysql_select_db(DB_NAME_, $Conn) or die("database not connected -> $Conn". sha1(mysql_error()));

and now any body here to know, how to connect php to sql server 2000? if yes please share us you knowledge of it.  thanks 

#2 jairathnem


    Advanced Member

  • Members
  • PipPipPip
  • 96 posts

Posted 20 February 2014 - 09:41 AM

try this
$serverName = "serverName\sqlexpress";
$connectionInfo = array("Database"=>"dbName","UID"=>"userName","PWD"=>"password");
$conn = sqlsrv_connect( $serverName, $connectionInfo);
check this too : http://www.techrepub...2000-using-php/

Edited by jairathnem, 20 February 2014 - 09:42 AM.

#3 kicken


    Wiser? Not exactly.

  • Gurus
  • 3,002 posts
  • LocationBonita, FL

Posted 20 February 2014 - 10:02 AM

You'll likely need to use the odbc functions to connect to sql server 2000, or use an older version of PHP.

The sqlsrv_* driver does not support less than 2005 according to the docs. The mssql_* functions were removed in php 5.3 since nobody was maintaining them and sqlsrv_* was better anyway.
Recycle your old CD's, don't trash them!
Did I help you out? Feeling generous? I accept tips via Paypal or Bitcoin @ 14mDxaob8Jgdg52scDbvf3uaeR61tB2yC7

#4 Yohanne


    Advanced Member

  • Members
  • PipPipPip
  • 200 posts

Posted 21 February 2014 - 12:57 AM

Thanks for all your reply and i got it,


and another one question. where should i place my php file whine i use sql server2000? since in wamp server i place it under www folder?

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users