CodeIgniter Forums

Full Version: Problem with "db->get"
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]Unknown[/eluser]
Hello all!,

I am new with CI, and I'm writing my first program.
I'm try connect to sql server 2008, and I'm connecting via odbc and
I have in my database.php following:

$db['default']['hostname'] = 'DRIVER={SQL Server};SERVER=192.168.0.207;DATABASE=CP';
$db['default']['username'] = 'Operador';
$db['default']['password'] = 'pe7878';
$db['default']['database'] = 'CP';
$db['default']['dbdriver'] = 'odbc';

but i'm getting the following error:


"A Database Error Occurred
Error Number: 37000
[Microsoft][ODBC SQL Server Driver][SQL Server]Sintaxis incorrecta cerca de ')'.
SELECT * FROM (cerepuertos)
Filename: T:\xampp\htdocs\AcopioCI\system\database\DB_driver.php
Line Number: 330"

which may be the cause?
I appreciate any suggestion,

best regards,

Fernando

El Forum

[eluser]Harold Villacorte[/eluser]
The config hostname is the hostame of the sql server. Try 'localhost.'

El Forum

[eluser]Unknown[/eluser]
Hello!,

The only solution I found was to add the following lines of code to db_driver.php.

IF (substr_count($sql,"INSERT")==0)
{
$arr = array("(", ")");
$valor=str_replace($arr,'',$sql);
$sql=$valor;
}
if anyone any better solution, I'll be grateful to receive,
Best Regards

Fernando