View Single Post

   
  #1 (permalink)  
Old 04-24-2008, 06:08 PM
Padiyath Sreekumaran
 
Posts: n/a
Default Php-mssql connection problems on Windows XP


Hello,
I can connect to a SQL server in the following way from my windows OS machine:
Start --> control Panel --> Administrative tools ---> Data Sources(ODBC)
and provide the necessary input. This works for me without problems.

I have installed xamp sw on this window machine. The SW version is
xampfile-win32.1.6.6a.This includes Apache, MySql and PHP SW.
How can I connect to the SQL server with a php script?I want to use
the same machine + database as I did in the above case.I have started
Apache + Mysql from xamp.The in Internet explorere I gave the following
Command: http://localhost/scrpt.php

I tried the follwong script from(script.php) :

<?php
$dsn="asi_qms";
$username="asi_qms_2006";
$password="something";
$server="xxx";
if(!$handle = odbc_connect($dsn, '$username', '$password')) die('Keine Verbindung möglich!');
?>

I got the following error when I execute the previous script:

Warning: odbc_connect() [function.odbc-connect]: SQL error: [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user '$username'., SQL state 28000 in SQLConnect in C:\xampplite\htdocs\script.php on line 6
Keine Verbindung möglich!

What is Iam missing? Any help is appreciated.
Please send a copy of the answer in my personal E-mail address also.

Thanks in advance.

Regards,
Kumar

------------------------------------------------------------------
Padiyath Sreekumar | Tel: +41.56.310.3643
Paul Scherrer Institut | email: kumar.padiyath@psi.ch
AIT | Office: WHGA/U132
WHGA/U132 | Fax: +41.56.310.3649
CH-5232 Villigen PSI |
Switzerland |
-----------------------------------------------------------------
Reply With Quote