Connecting to a sql server with PHP

edited January 2008 in Internet & Media
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

Comments

  • ButtersButters CA Icrontian
    edited January 2008
    I just want to clarify a couple things..

    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.
Sign In or Register to comment.