Connecting to a sql server with PHP
I'm trying to connect to a sql server database creating with coldfusion using php. This is what I have to start...
$sqldsn="dsn";
$sqlusername="username";
$sqlpassword="password";
$connect = odbc_connect($sqldsn, $sqlusername, $sqlpassword);
if ($connect)
{
echo "connected";
}
else echo "not connected";
?>
Assuming the dsn, username and password are correct, is this the most 'common' way to connect. I get 'not connected' everytime. The database is being hosted with godaddy.com
$sqldsn="dsn";
$sqlusername="username";
$sqlpassword="password";
$connect = odbc_connect($sqldsn, $sqlusername, $sqlpassword);
if ($connect)
{
echo "connected";
}
else echo "not connected";
?>
Assuming the dsn, username and password are correct, is this the most 'common' way to connect. I get 'not connected' everytime. The database is being hosted with godaddy.com
0
Comments
So you are switching from CF to PHP and you want to connect to a MS SQL db?
I'd just use PHP's built in MS SQL support otherwise it would be hard to tell assuming that all DSN, SQL drivers, and address is correct.