MSSQL INSERT query problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Here is the code I use:

$dsn = "mssql://username:password@xxxxxxxxxxxx/database";

$options = array(
    'debug'       => 2,
    'portability' => DB_PORTABILITY_ALL,
);

$db =& DB::connect($dsn, $options);
if (DB::isError($db)) {
 $db->getDebugInfo();
 die($db->getMessage());
}

$sql =& $db->prepare("INSERT INTO ExitSurveyAnswers (session_id,
Question_id, answer) VALUES ?,?,?");

// Always check that result is not an error
if (DB::isError($sql)) {
 $sql->getDebugInfo();
 die($sql->getMessage());
}

$alldata = array($id,$question,$answer);

$res =& $db->execute($sql, $alldata);
 print_r ($res);
if (DB::isError($res)) {
 $res->getDebugInfo();
 die($res->getMessage());
}

$db->disconnect();

When I execute it I keep recieving and error message stating:
DB Error: syntax error

I use PEAR DB and PEAR HTTP SESSION.

Any ideas will be helpful.

Thanks,
Chris

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux