[PHP] Getting PHP on Windows to talk to MS SQL?

2004-07-23 Thread weston
I'm trying to get PHP (for Windows) to talk to MS SQL Server. This
is proving to be non-trivial...

I downloaded and installed the Windows binary package on my machine 
(the machine is running Microsfot Windows XP Professional), and 
jumped through the hoops to get it running under Apache 2.0. So
far, so good.

Now, the first thing I noted was that the mssql functions actually
don't seem to exist in the binary... and apparently you have to
compile them in to PHP, after having built FreeTDS. This seems a bit
odd, as it's not at all clear to me that FreeTDS actually will
build under Windows at all (it being a UNIX solution). I did try
building it under cygwin, which ended with a flurry of error messages
in bsqldb.c, so this assumption seems correct. 

All right, approach #2... maybe I can use COM objects to try to 
connect to an ODBC data source, something like an example I found
on the php documentation for mssql:

$db = new COM(ADODB.Connection);
$dsn = DRIVER=SQL Server; SERVER=my.local.server;UID=user;PWD=passwd; 
DATABASE=dbname;
$db-Open($dsn);
$rs = $db-Execute(SELECT * FROM project LIMIT 1);

while (!$rs-EOF)
{
echo $rs-Fields['project_id']-Value.BR;
$rs-MoveNext();
}

This seems to at least kick up no errors up to a point... and 
that point is when I try to wind through that loop. 

Any ideas what the right best way to do this is? I'd prefer to
use the mssql functions if I can... 

Thanks,

Weston

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Getting PHP on Windows to talk to MS SQL?

2004-07-23 Thread Jason Wong
On Friday 23 July 2004 15:15, [EMAIL PROTECTED] wrote:

Questions which are DB related should be posted to the php-db list.

 I'm trying to get PHP (for Windows) to talk to MS SQL Server. This
 is proving to be non-trivial...

[snip]

Have you gone through the suggestions in the user notes on the online manual?

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
Why is it called a TV set when you only get one? 
-- Why Why Why n39
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Getting PHP on Windows to talk to MS SQL?

2004-07-23 Thread Paul Kain
Hi Weston, maybe this page can help you

http://in.php.net/manual/en/function.odbc-connect.php




On Fri, 23 Jul 2004 02:15:11 -0500, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
 I'm trying to get PHP (for Windows) to talk to MS SQL Server. This
 is proving to be non-trivial...
 
 I downloaded and installed the Windows binary package on my machine
 (the machine is running Microsfot Windows XP Professional), and
 jumped through the hoops to get it running under Apache 2.0. So
 far, so good.
 
 Now, the first thing I noted was that the mssql functions actually
 don't seem to exist in the binary... and apparently you have to
 compile them in to PHP, after having built FreeTDS. This seems a bit
 odd, as it's not at all clear to me that FreeTDS actually will
 build under Windows at all (it being a UNIX solution). I did try
 building it under cygwin, which ended with a flurry of error messages
 in bsqldb.c, so this assumption seems correct.
 
 All right, approach #2... maybe I can use COM objects to try to
 connect to an ODBC data source, something like an example I found
 on the php documentation for mssql:
 
 $db = new COM(ADODB.Connection);
 $dsn = DRIVER=SQL Server; SERVER=my.local.server;UID=user;PWD=passwd; 
 DATABASE=dbname;
 $db-Open($dsn);
 $rs = $db-Execute(SELECT * FROM project LIMIT 1);
 
 while (!$rs-EOF)
 {
 echo $rs-Fields['project_id']-Value.BR;
 $rs-MoveNext();
 }
 
 This seems to at least kick up no errors up to a point... and
 that point is when I try to wind through that loop.
 
 Any ideas what the right best way to do this is? I'd prefer to
 use the mssql functions if I can...
 
 Thanks,
 
 Weston
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php