focus310
03-30-2007, 07:03 PM
Hello:
I'm trying to write a query which will update values after they were inserted.
Once a set of rates is inputed for a new lender and program, the rates will be inserted into the table. Later, if there is a new set of rates for the program/lender which was just inserted, I want to update those rates.
How do I go about writing my update statement?
Thank you for the help.
This is my insert statement:
$query2 = "INSERT INTO rates (program_id, program_code, lender_id, lender_code, rate, price, date, time)
VALUES ('$_SESSION[program_id]','$_SESSION[program_code]','$_SESSION[lender_id]','$_SESSION[lender_code]','$_SESSION[rate1]','$_SESSION[price1]', CURRENT_DATE, CURRENT_TIME),
('$_SESSION[program_id]','$_SESSION[program_code]','$_SESSION[lender_id]','$_SESSION[lender_code]','$_SESSION[rate2]','$_SESSION[price2]', CURRENT_DATE, CURRENT_TIME),
('$_SESSION[program_id]','$_SESSION[program_code]','$_SESSION[lender_id]','$_SESSION[lender_code]','$_SESSION[rate3]','$_SESSION[price3]', CURRENT_DATE, CURRENT_TIME),
('$_SESSION[program_id]','$_SESSION[program_code]','$_SESSION[lender_id]','$_SESSION[lender_code]','$_SESSION[rate4]','$_SESSION[price4]', CURRENT_DATE, CURRENT_TIME)";
I'm trying to write a query which will update values after they were inserted.
Once a set of rates is inputed for a new lender and program, the rates will be inserted into the table. Later, if there is a new set of rates for the program/lender which was just inserted, I want to update those rates.
How do I go about writing my update statement?
Thank you for the help.
This is my insert statement:
$query2 = "INSERT INTO rates (program_id, program_code, lender_id, lender_code, rate, price, date, time)
VALUES ('$_SESSION[program_id]','$_SESSION[program_code]','$_SESSION[lender_id]','$_SESSION[lender_code]','$_SESSION[rate1]','$_SESSION[price1]', CURRENT_DATE, CURRENT_TIME),
('$_SESSION[program_id]','$_SESSION[program_code]','$_SESSION[lender_id]','$_SESSION[lender_code]','$_SESSION[rate2]','$_SESSION[price2]', CURRENT_DATE, CURRENT_TIME),
('$_SESSION[program_id]','$_SESSION[program_code]','$_SESSION[lender_id]','$_SESSION[lender_code]','$_SESSION[rate3]','$_SESSION[price3]', CURRENT_DATE, CURRENT_TIME),
('$_SESSION[program_id]','$_SESSION[program_code]','$_SESSION[lender_id]','$_SESSION[lender_code]','$_SESSION[rate4]','$_SESSION[price4]', CURRENT_DATE, CURRENT_TIME)";