On Mon, 19 Oct 2009, James Janovich wrote:

> I am having in issue getting the lastInsertId.  I tried using it against the
> stmt object and the db handle with no avail:
> 
>     $db = ezcDbInstance::get();
>     $q = $db->createInsertQuery();
>  $q->insertInto( 'ticket' )
>     ->set( 'summary',       $q->bindValue( $input['summary'] ) )
>     ->set( 'description',   $q->bindValue( $input['description'] ) )
>     ->set( 'priority_id',   $q->bindValue( $input['priority'] ) )
>     ->set( 'severity_id',   $q->bindValue( $input['severity'] ) )
>     ->set( 'department_id', $q->bindValue( $input['department'] ) )
>     ->set( 'user_id',       $q->bindValue( '1' ) )
>     ->set( 'status_id',     $q->bindValue( '1' ) );
>     $stmt = $q->prepare();
>     $stmt->execute();
> 
> tried:
> 
> $stmt->lastInsertId();
> $db->lastInsertId();

The latter should work, are you sure your db schema has an auto 
increment field? And do you get any errors?

regards,
-- 
Derick Rethans
eZ components Product Manager
eZ systems | http://ez.no
-- 
Components mailing list
Components@lists.ez.no
http://lists.ez.no/mailman/listinfo/components

Reply via email to