Re: Last ID Problem - Mailing list pgsql-novice

From Vishal Kashyap @ [SaiHertz]
Subject Re: Last ID Problem
Date
Msg-id 77b69d2105013111251fac2451@mail.gmail.com
Whole thread Raw
In response to Last ID Problem  (<operationsengineer1@yahoo.com>)
Responses Re: Last ID Problem  (<operationsengineer1@yahoo.com>)
List pgsql-novice
Hi,

> $id = "SELECT currval('cust_id')"; // used in an
> attempt to get last id (colum 'cust id')entered into
> db.
>
> $result = $db->Execute($sql);  // works fine.
>
> $id_result = $db->execute($id);  // $id_result has no
> 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,
http://saihertz.com,
http://vishalkashyap.tk

pgsql-novice by date:

Previous
From:
Date:
Subject: Last ID Problem
Next
From:
Date:
Subject: Re: Last ID Problem