|
Home > Archive > PHP with PostgreSQL > May 2005 > last value
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| Roni Warken 2005-05-04, 7:24 am |
| I tried to search some thread that could help me, but didn't find
anything (maybe because I didn't know how to search).
I have a script that insert some values in a table. After this, I have
to take the value of the primary key just inserted, and insert it in
another table, all in the same script.
How can I do that? Or if you have a better idea of how to get the last
value and insert in the other table, please tell me.
Thanks.
--
Roni Warken
---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings
| |
| Pawel Bernat 2005-05-04, 9:24 am |
| On Wed, May 04, 2005 at 09:18:12AM -0300, Roni Warken wrote:
> How can I do that? Or if you have a better idea of how to get the last
> value and insert in the other table, please tell me.
CURRVAL()
p.
--
Paweł Bernat; uselessness' lover;
select'< asm'||chr(64)||'asm'
||'. '||'flynet'||chr(46)
||'pl>'as email;
Slowly and surely the unix crept up on the Nintendo user ...
---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match
| |
| Thom Dyson 2005-05-04, 9:24 am |
| Since this is a data integrity question (I presume) as much as an
application question, you could put a trigger on the 1st table that says,
"when a new record is added, seed data in other tables". I have it at
work. If you need more info, let me know.
Thom Dyson
Director of Information Services
Sybex, Inc.
pgsql-php-owner@postgresql.org wrote on 05/04/2005 09:18:12 AM:
> I tried to search some thread that could help me, but didn't find
> anything (maybe because I didn't know how to search).
> I have a script that insert some values in a table. After this, I have
> to take the value of the primary key just inserted, and insert it in
> another table, all in the same script.
> How can I do that? Or if you have a better idea of how to get the last
> value and insert in the other table, please tell me.
> Thanks.
> --
> Roni Warken
> ---------------------------(end of broadcast)---------------------------
> TIP 7: don't forget to increase your free space map settings
---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?
http://www.postgresql.org/docs/faq
| |
| moalaniz@unsl.edu.ar 2005-05-04, 9:24 am |
| unsubscribe
---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?
http://www.postgresql.org/docs/faq
| |
| Ramakrishnan Muralidharan 2005-05-05, 3:24 am |
| Hi,
Create a Trigger for the first table for updating the primary key of the fist table into second table
Regards,
R.Muralidharan
-----Original Message-----
From: pgsql-php-owner@postgresql.org
[mailto:pgsql-php-owner@postgresql.org]On Behalf Of Roni Warken
Sent: Wednesday, May 04, 2005 5:48 PM
To: pgsql-php@postgresql.org
Subject: [PHP] last value
I tried to search some thread that could help me, but didn't find
anything (maybe because I didn't know how to search).
I have a script that insert some values in a table. After this, I have
to take the value of the primary key just inserted, and insert it in
another table, all in the same script.
How can I do that? Or if you have a better idea of how to get the last
value and insert in the other table, please tell me.
Thanks.
--
Roni Warken
---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings
---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere
" to majordomo@postgresql
.org)
|
|
|
|
|