will your suggestion protect my db if I have two
customers with the same name? does it always return
the highest cust_id and is that *always* the last
--- "Vishal Kashyap @ [SaiHertz]"
> > $id = "SELECT currval('cust_id')"; // used in an
> > attempt to get last id (colum 'cust id')entered
> > db.
> > $result = $db->Execute($sql); // works fine.
> > $id_result = $db->execute($id); // $id_result has
> > value.
> This is because currval fetched data during a
> transaction process and
> not after the process is complete.
> the best way I suggest is
> $id = "SELECT cust_id from customer where
> customer_name ='$cust'
> order by cust_id desc limit1" ; // used in an
> With Best Regards,
> Vishal Kashyap.
> Lead Software Developer,
> ---------------------------(end of
> TIP 6: Have you searched our list archives?
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
In response to
pgsql-novice by date
|Next:||From: Michael Fuhr||Date: 2005-01-31 19:46:01|
|Subject: Re: How to learn Postgres?|
|Previous:||From: Vishal Kashyap @ [SaiHertz]||Date: 2005-01-31 19:25:55|
|Subject: Re: Last ID Problem|
pgsql-hackers by date
|Next:||From: Tom Lane||Date: 2005-01-31 19:36:33|
|Subject: Re: [BUGS] Bug in create operator and/or initdb |
|Previous:||From: Greg Stark||Date: 2005-01-31 19:35:58|
|Subject: Re: [BUGS] Bug in create operator and/or initdb|