Replace multiple fields in active record with one variable
Posted: Tue Apr 21, 2009 3:11 pm
Hello
Not sure how to do this in php, but what I am trying to achieve is to replace several fields in a record with a single variable.
For example, if I had a table in my database (MySQL) and a table with fields price1, price2, price3, price4 etc and wanted to replace them with a value stored in newprice that has been entered into a field by me, how could I do that?
I see there is a command called INSERT but that adds a record to the table.
I have also found this command:
So if this is the command:
1. How would I add additional fields?
2. How do I ensure that the correct record is updated?
3. How can I implement this process via a command button
I would either like to do this via a command button in php or a hyperlink, it makes no difference.
If you need more information please let me know and some guidance would be most advantageous.
Thank you
Not sure how to do this in php, but what I am trying to achieve is to replace several fields in a record with a single variable.
For example, if I had a table in my database (MySQL) and a table with fields price1, price2, price3, price4 etc and wanted to replace them with a value stored in newprice that has been entered into a field by me, how could I do that?
I see there is a command called INSERT but that adds a record to the table.
I have also found this command:
Code: Select all
UPDATE my_table SET `my_field` = replace(`my_field`, "old_text", "new_text")1. How would I add additional fields?
2. How do I ensure that the correct record is updated?
3. How can I implement this process via a command button
I would either like to do this via a command button in php or a hyperlink, it makes no difference.
If you need more information please let me know and some guidance would be most advantageous.
Thank you