Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

$mssql = odbc_connect( and odbc_exec code

Joined
Jan 22, 2009
Messages
45
Reaction score
1
hi i am having problems with $mssql = odbc_connect(
and odbc_exec can anyone help i cant seem to get them to work
 
ThuGie.NL - Webmaster
Joined
Apr 16, 2006
Messages
607
Reaction score
55
Hey,

Perhaps you should give more information.
What does not work ? does it not connect ? does it give a error ?

How are you using it ?
Got a sample of your code ?
 
Joined
Jan 22, 2009
Messages
45
Reaction score
1
we just need the codes for mssql+odbc_connect with pdo and odbc_exe to see the data

$cnx = new PDO("odbc:Driver={EFR};Server=localhost;Port:7004;Database=EFR", 'LcLfVJFLTKTCEHRO', '*'); –
 

cMu

Elite Diviner
Joined
Jan 8, 2017
Messages
427
Reaction score
133
new PDO('odbc:Driver={SQL Server Native Client 10};Server='.SQL_HOST.';Database='.SQL_WEB_DB.'', SQL_USER, SQL_PASSWORD)
 
Joined
Jan 22, 2009
Messages
45
Reaction score
1
new PDO('odbc:Driver={SQL Server Native Client 10};Server='.SQL_HOST.';Database='.SQL_WEB_DB.'', SQL_USER, SQL_PASSWORD)

the "new PDO('odbc:Driver={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.
 

cMu

Elite Diviner
Joined
Jan 8, 2017
Messages
427
Reaction score
133
the "new PDO('odbc:Driver={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...
 
Joined
Jan 22, 2009
Messages
45
Reaction score
1
provide full code, is there any reason you uses odbc connection? that's should be like the last choice for you to do...


define("Username", 'sa');
define("Passowrd", 'dbpassword');
define("DSN", 'odbc:Driver={SQL Server};server=SERVERNAME\SQLEXPRESS');
try {
$mssql = new PDO("odbc:Driver={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();
 

cMu

Elite Diviner
Joined
Jan 8, 2017
Messages
427
Reaction score
133
define("Username", 'sa');
define("Passowrd", 'dbpassword');
define("DSN", 'odbc:Driver={SQL Server};server=SERVERNAME\SQLEXPRESS');
try {
$mssql = new PDO("odbc:Driver={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();
And what is the exact error you get?
 
Joined
Jan 22, 2009
Messages
45
Reaction score
1
it is fixed now thanks for you help
we have to figure it out now theses are the codes php.pdo
define("Username", 'sa');
define("Passowrd", 'dbpassword');
define("DSN", 'odbc:Driver={SQL Server};server=SERVERNAME\SQLEXPRESS');
try {
$mssql = new PDO("odbc:Driver={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();
 
Back
Top