Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

UPDATE MySQL using the URL variable

Avatar of detox1978
detox1978Flag for United Kingdom of Great Britain and Northern Ireland asked on
6 Comments1 Solution236 ViewsLast Modified:
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.
Avatar of steelseth12
This problem has been solved!
Unlock 1 Answer and 6 Comments.
See Answers