UPDATE MySQL using the URL variable
Posted on 2007-03-25
I need some help with a PHP script i'm working on.
Basically i need to create several SQL UPDATE statements based on the information in the URL. Unfortunatley the row to update is part of the variable name, so i need to split this information out somehow.
All the variables i want to use will have their row number followed by an underscore "_" followed by their field name;
123_gift_description = UPDATE row 123, field gift_description
27_gift_description = UPDATE row 27, field gift_description
19_name = UPDATE row 19, field name
An example URL would be;
And the MySQL Updates would be;
UPDATE gift_list SET gift_description='new+car' WHERE id ='123';
UPDATE gift_list SET gift_description='space+hopper' WHERE id ='27';
UPDATE gift_list SET name='Craig+Short' WHERE id ='19';
-hopefully that made sense.....
If it help i'm only updating two fields, name and gift_description
Many thanks in Adv.