Hi there,

in theory there's not often a need for this kind of query..

For example, if you save an object, you get the new ID immediately..

$object = new Whatever();
$object -> save();
$latest_id = $object -> getId();


Daniel


On May 21, 5:47 am, kadia dia <[email protected]> wrote:
> Thank you for u help, It's ok now; I have just changed some details. And the
> good code for propel is:
>
> $c= new Criteria();
>
> $c->addDescendingOrderByColumn(id);
>
> $item = ClasseNamePeer::doSelectOne($c);
>
> $x= $item->getId();
>
> 2010/5/21 Gábor Fási <[email protected]>
>
>
>
> > If last means the biggest id, something like this in your peer class will
> > do:
>
> > public static function getLastId()
> > {
> >  $c = new Criteria();
> >  $c->addDescendingOrderByColumn(self::ID);
> >  $item = self::doSelectOne($c);
> >  return $item->getId();
> >  }
>
> > On Fri, May 21, 2010 at 12:14, kadia dia <[email protected]> wrote:
> > > Thank u for your answer, but I use Propel. I have not found an answer
> > yet,
> > > so if u can help me. It will be really good for me.
>
> > > 2010/5/20 Abraham Montilla <[email protected]>
>
> > >> you mean using Propel? in Doctrine is as simple as using the getLast()
> > >> method after the execute() method.
>
> > >> 2010/5/20 kadia <[email protected]>
>
> > >>> I have a problem for getting the last id from a table, I have to use
> > >>> criteria for that.
> > >>> Thank you
>
> > >>> --
> > >>> If you want to report a vulnerability issue on symfony, please send it
> > to
> > >>> security at symfony-project.com
>
> > >>> You received this message because you are subscribed to the Google
> > >>> Groups "symfony users" group.
> > >>> To post to this group, send email to [email protected]
> > >>> To unsubscribe from this group, send email to
> > >>> [email protected]<symfony-users%[email protected]>
> > >>> For more options, visit this group at
> > >>>http://groups.google.com/group/symfony-users?hl=en
>
> > >> --
> > >> Have a nice day.
> > >> Abraham Montilla.
>
> > >> --
> > >> If you want to report a vulnerability issue on symfony, please send it
> > to
> > >> security at symfony-project.com
>
> > >> You received this message because you are subscribed to the Google
> > >> Groups "symfony users" group.
> > >> To post to this group, send email to [email protected]
> > >> To unsubscribe from this group, send email to
> > >> [email protected]<symfony-users%[email protected]>
> > >> For more options, visit this group at
> > >>http://groups.google.com/group/symfony-users?hl=en
>
> > > --
> > > If you want to report a vulnerability issue on symfony, please send it to
> > > security at symfony-project.com
>
> > > You received this message because you are subscribed to the Google
> > > Groups "symfony users" group.
> > > To post to this group, send email to [email protected]
> > > To unsubscribe from this group, send email to
> > > [email protected]<symfony-users%[email protected]>
> > > For more options, visit this group at
> > >http://groups.google.com/group/symfony-users?hl=en
>
> > --
> > If you want to report a vulnerability issue on symfony, please send it to
> > security at symfony-project.com
>
> > You received this message because you are subscribed to the Google
> > Groups "symfony users" group.
> > To post to this group, send email to [email protected]
> > To unsubscribe from this group, send email to
> > [email protected]<symfony-users%[email protected]>
> > For more options, visit this group at
> >http://groups.google.com/group/symfony-users?hl=en
>
> --
> If you want to report a vulnerability issue on symfony, please send it to 
> security at symfony-project.com
>
> You received this message because you are subscribed to the Google
> Groups "symfony users" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group 
> athttp://groups.google.com/group/symfony-users?hl=en

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to