Newbie Spellweaver
- Joined
- Jan 22, 2009
- Messages
- 45
- Reaction score
- 1
new PDO('odbcriver={SQL Server Native Client 10};Server='.SQL_HOST.';Database='.SQL_WEB_DB.'', SQL_USER, SQL_PASSWORD)
provide full code, is there any reason you uses odbc connection? that's should be like the last choice for you to do...the "new PDO('odbcriver={SQL Server Native Client 10};Server='.SQL_HOST.';Database='.SQL_WEB_DB.'', SQL_USER, SQL_PASSWORD)" is added on the code. but the global odbc_exec is lacking.
provide full code, is there any reason you uses odbc connection? that's should be like the last choice for you to do...
And what is the exact error you get?define("Username", 'sa');
define("Passowrd", 'dbpassword');
define("DSN", 'odbcriver={SQL Server};server=SERVERNAME\SQLEXPRESS');
try {
$mssql = new PDO("odbcriver={SQL Server};server=SERVERNAME\SQLEXPRESS;DATABASE=account_dbf", Username, Passowrd);
}
catch(PDOException $exception){
echo "Connection error: " . $exception->getMessage();
}
$query = "SELECT account, FROM ACCOUNT_DBF.dbo.ACCOUNT_TBL";
$stmt = $mssql->prepare($query);
$stmt->execute();