Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > PHP Databases
PHP Databases Using PHP in conjunction with databases. PHP questions not specific to databases should be directed to one of the other PHP forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old August 18th, 2004, 09:19 AM
ez ez is offline
Registered User
Join Date: Jun 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problem MSSQL2000 - PHP5

Hi all.
My Win2000 computer has MSSQL Server 2000 and PHP5. I need a help to
connect MSSQL - PHP and retrieve data from database. Can you show me
example how to connect and retrieve whole table and give brief explanation?
I appreciate any help.

Old August 19th, 2004, 05:31 AM
Friend of Wrox
Join Date: Jun 2003
Posts: 256
Thanks: 0
Thanked 0 Times in 0 Posts

The simplest way would be to use the mssql function libraries, e.g. mssql_pconnect():


(The list at the left of that page shows you the other members of this function family, and will provide an overview of how to use them).

That would be the crude "get you up and running" approach. All of the reader comments on the PHP site will be of great help in understanding how to use SQL Server with PHP. These native functions do not usually form part of a default instalation of PHP, so you may have to compile them in yourself, or obtain the relevant RPM/Deb package/wahtever. They are the fastest way of gtting data in and out of SQL Server DBs, but they are probably a bit out of place in the object-oriented world of PHP5. It depend how longterm this work will be. The function libraries are the quick-and-dirty (very quick, in fact, you'll be up there with .NET applications in sheer speed of running). A more abstracted route such as DB::PEAR may be a better bet for longterm maintainability and portability. I've only ever had to strip data out of legacy SQL Server DBs on an as-needed basis, so I've tended to go the quick and dirty route, I must admit. You will probably need something more permanent. There aren't a lot of longterm SQL Server bods on these forums (the PHP ones, I mean), I don't think.

THere are a good many tutorials about going the ODBC approach to interrogating SQL Server 2000 using PHP, such as this one at Builder:

There won't be a lot about PHP5-specific ways of gaining access, yet, but hey, you could end up being one of the guys that writes one of them ;).

Best of luck,

Similar Threads
Thread Thread Starter Forum Replies Last Post
Recover Deleted Records from MSSQL2000 hashimkply SQL Server 2005 1 January 15th, 2007 09:07 AM
Professional PHP5 p25 Interface Problem mercury7 Beginning PHP 0 January 13th, 2006 03:18 AM
PHP5 connection problem with MYSQL Calverstine PHP Databases 3 August 31st, 2005 01:27 AM
PHP5 connection problem with MYSQL Calverstine PHP How-To 0 August 22nd, 2005 05:09 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.