PHP & MSSQL Express issues (Newbie)
Hi All,
I am trying to collect info from a MSSQL DB and I am not even able to
get passed the connection. I don't get any errors I just get a blank
page when I go to the site.
PHP is working, see attached phpinfo(). Any help is appreciated.
Windows XP SP2, IIS 5.1, PHP 5.2.1, MSSQL Server Express Edition
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<?php
$con=mssql_connect("serverName\sqlexpress","username","passw ord");
if ($con)
$conStatus="It connnected";
else
$conStatus "didn't work";
mssql_close($con);
?>
<title>Test PHP MSSQL</title>
</head>
<body>
<?php echo $conStatus; ?>
</body>
</html>
Re: PHP & MSSQL Express issues (Newbie)
Todd Michels wrote:
> Hi All,
>
> I am trying to collect info from a MSSQL DB and I am not even able to
> get passed the connection. I don't get any errors I just get a blank
> page when I go to the site.
>
> PHP is working, see attached phpinfo(). Any help is appreciated.
>
> Windows XP SP2, IIS 5.1, PHP 5.2.1, MSSQL Server Express Edition
>
>
>
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml">
> <head>
> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
>
> <?php
> $con=mssql_connect("serverName\sqlexpress","username","passw ord");
>
> if ($con)
> $conStatus="It connnected";
> else
> $conStatus "didn't work";
>
> mssql_close($con);
> ?>
>
> <title>Test PHP MSSQL</title>
>
> </head>
>
> <body>
>
> <?php echo $conStatus; ?>
>
> </body>
>
> </html>
I suggest you look a little bit at the user comments at
http://www.php.net/manual/en/function.mssql-connect.php
it seems like there are differences depending on the version of mssql.
You could try to use
$con=mssql_connect("localhost,1433","username","password");
--
//Aho
Re: PHP & MSSQL Express issues (Newbie)
On Sun, 25 Feb 2007 13:18:48 +0100, "J.O. Aho" <user [at] example.net>
wrote:
>Todd Michels wrote:
>> Hi All,
>>
>> I am trying to collect info from a MSSQL DB and I am not even able to
>> get passed the connection. I don't get any errors I just get a blank
>> page when I go to the site.
>>
>> PHP is working, see attached phpinfo(). Any help is appreciated.
>>
>> Windows XP SP2, IIS 5.1, PHP 5.2.1, MSSQL Server Express Edition
>>
>>
>>
>>
>> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
>> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
>> <html xmlns="http://www.w3.org/1999/xhtml">
>> <head>
>> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
>>
>> <?php
>> $con=mssql_connect("serverName\sqlexpress","username","passw ord");
>>
>> if ($con)
>> $conStatus="It connnected";
>> else
>> $conStatus "didn't work";
>>
>> mssql_close($con);
>> ?>
>>
>> <title>Test PHP MSSQL</title>
>>
>> </head>
>>
>> <body>
>>
>> <?php echo $conStatus; ?>
>>
>> </body>
>>
>> </html>
>
>I suggest you look a little bit at the user comments at
>http://www.php.net/manual/en/function.mssql-connect.php
>it seems like there are differences depending on the version of mssql.
>
>You could try to use
>$con=mssql_connect("localhost,1433","username","password");
Mine is localhost for what it's worth. I struggled with this too :)
Re: PHP & MSSQL Express issues (Newbie)
Ron wrote:
> On Sun, 25 Feb 2007 13:18:48 +0100, "J.O. Aho" <user [at] example.net>
> wrote:
>> I suggest you look a little bit at the user comments at
>> http://www.php.net/manual/en/function.mssql-connect.php
>> it seems like there are differences depending on the version of mssql.
>>
>> You could try to use
>> $con=mssql_connect("localhost,1433","username","password");
>
> Mine is localhost for what it's worth. I struggled with this too :)
What error message do you guys get when you try to connect, try to output the
mssql_get_last_message() (mssql don't have at all as much error reporting
support as mysql).
--
//Aho