Forum Moderators: coopster

Message Too Old, No Replies

Postgresql

Tables Postgresql

         

Imy_S3

12:10 pm on Feb 24, 2004 (gmt 0)

10+ Year Member



Got a 2 tables

table 1
ID name Price

table 2
ID Price
1 6.99
2 8.99
3 641.00

table one has colums ID, name, and price.
table two has columsn ID and Price.

There is going to be a html page where the user can enter the names and prices into table one.

how do i create the tables so that for example when the user types 3 in to the price field of table one, it automatically looks for id 3 in table two and puts the value of 641.00 there.

Hope you can help,
Thanks in advance.

dcrombie

12:18 pm on Feb 24, 2004 (gmt 0)



I'm not entirely clear on what you're doing but wouldn't it be better to have the contents of table2 appear as a SELECT list instead of making people type in a text box?

Imy_S3

12:54 pm on Feb 24, 2004 (gmt 0)

10+ Year Member



no, do not want like that,

what do u not get?

coopster

8:17 pm on Feb 24, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



How do you create the tables?
Or how do you populate the tables...?
To populate, you could use an INSERT...SELECT statement.

INSERT INTO table1
(ID, name, Price)
SELECT
$my_ID_variable,
$my_name_variable,
table2.Price
FROM table2
WHERE $my_price_variable = table2.ID
;