Last ID Problem

From: <operationsengineer1(at)yahoo(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Last ID Problem
Date: 2005-01-31 19:13:58
Message-ID: 20050131191358.22644.qmail@web52405.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-novice

i'm setting up a data entry entry form. once the data
is entered in a pgsql, i want to have it redisplay the
blank form with the text just entered displayed.

I have it so it enters data. i'm having a problem
with permissions so i have to use the database creator
and owner to access the db.

i'm using adodb and the following code to interact
with my db...

-----------------------

$cust = $_POST['cust']; // data entered
$cust = addslashes($cust); // take care of slashes

$db = &ADONewConnection('postgres');
$db -> Connect($db_string,$db_owner,$db_pw,$db_name);

$sql = "INSERT INTO customer (customer_name) VALUES
('$cust')"; // query to insert data - works fine.

$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.

------------------------------

does anyone know how i can structure this so that i
get the last 'cust_id' entered so that i can then use
that id to display the data just entered?

tia...

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Victor Yegorov 2005-01-31 19:15:59 Combining index scans
Previous Message Tom Lane 2005-01-31 19:06:34 Re: weird behaviour on DISTINCT ON

Browse pgsql-novice by date

  From Date Subject
Next Message Vishal Kashyap @ [SaiHertz] 2005-01-31 19:25:55 Re: Last ID Problem
Previous Message Van Ingen, Lane 2005-01-31 19:12:44 Re: Date / Time Data Type