|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
undefined method DB_mssql::lastInsertId() ??Hello! I'm constantly running in to these types of issues. I must be doing something fundamentally wrong. I've instantiated a database connection like so:
// ----------------------------------------------------------------------
$dsn = $config->dbadaptor . "://" // Build a DSN string (Data Source Name)
. $config->username . ":" // Required by DB::connect()
. $config->password . "@"
. $config->host . "/"
. $config->dbname;
$db = DB::connect($dsn, TRUE);
if (DB::isError($db)) {
die($db->getMessage());
}
$this->db = $db;
// ----------------------------------------------------------------------
Later in my code, I do something like this:
// ----------------------------------------------------------------------
$sql = "INSERT INTO $table_name (" . implode(',',$transformed_keys) . ') VALUES ( ' . implode(',',$values) . ' ) ';
$result = $this->db->query($sql);
$id = $this->db->lastInsertId();
// ----------------------------------------------------------------------
Unfortunately, I get the error, "undefined method DB_mssql::lastInsertId()". What am I doing wrong? Thanks! - Bret |
|
|
Re: undefined method DB_mssql::lastInsertId() ??DB::connect looks like a PEAR factory method - are you sure you're using Zend Framework? If not, you'd need to post to a PEAR mailing list.
Hello! I'm constantly running in to these types of issues. I must be doing something fundamentally wrong. I've instantiated a database connection like so: -- Simon Mundy | Director | PEPTOLAB """ " "" """""" "" "" """"""" " "" """"" " """"" " """""" "" " Please support Movember today! Visit http://www.movember.com/au/donate Registration number for Simon 160725 202/258 Flinders Lane | Melbourne | Victoria | Australia | 3000 Voice +61 (0) 3 9654 4324 | Mobile 0438 046 061 | Fax +61 (0) 3 9654 4124 |
|
|
Re: undefined method DB_mssql::lastInsertId() ??Woops! Ha ha ha. I'm an idiot. Sorry about that. I got confused about which database library I was using. Thanks!
|
| Free embeddable forum powered by Nabble | Forum Help |