Woops! Ha ha ha. I'm an idiot. Sorry about that. I got confused about
which database library I was using. Thanks!
Simon Mundy wrote:
>
> 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:
>>
>> //
>> ----------------------------------------------------------------------
>> $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
>> View this message in context: undefined method
>> DB_mssql::lastInsertId() ??
>> Sent from the Zend Framework mailing list archive at Nabble.com.
>
> --
>
> 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
> http://www.peptolab.com
>
>
>
--
View this message in context:
http://www.nabble.com/undefined-method-DB_mssql%3A%3AlastInsertId%28%29----tf4853199s16154.html#a13888106
Sent from the Zend Framework mailing list archive at Nabble.com.