Last ID Problem - Mailing list pgsql-novice

From
Subject Last ID Problem
Date
Msg-id 20050131191358.22644.qmail@web52405.mail.yahoo.com
Whole thread Raw
Responses Re: Last ID Problem  ("Vishal Kashyap @ [SaiHertz]" <vishalonlist@gmail.com>)
Re: Last ID Problem  (Mitch Pirtle <mitch.pirtle@gmail.com>)
List 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

pgsql-novice by date:

Previous
From: Terry Lee Tucker
Date:
Subject: Re: How to learn Postgres?
Next
From: "Vishal Kashyap @ [SaiHertz]"
Date:
Subject: Re: Last ID Problem