0

I am wondering from 2 days but didn't get any suitable solution for my problem. I am working on a project and here I stuck on updating all rows of a MySQL table using single Update Query in PHP. Let's Suppose I have the table like given below

id |  heading  |  description
---------------------------
1    heading1    desc1

2    heading2    desc2

3    heading3    desc3

Now I want to update the heading, description fields using single update query. how will I loop the form for this ? can somebody suggest the easy and most efficient way to do this.

1
  • dude... have you tried anything or did your teacher just assign some homework and you want someone else to do it? Commented Nov 1, 2016 at 17:05

1 Answer 1

3

could be a simple updated

update my_table  
set heading  = 'my_value1',
    description = 'my_value2';

eventually you can add some where for proper filter

update my_table  
set heading  = 'my_value1',
    description = 'my_value2'
where heading = 'a_value';
Sign up to request clarification or add additional context in comments.

1 Comment

What's the problem for 100 rows .. ? ... 100.000 ... 1000.000 .. and update is an update .. (if you need you can limit,, but if you don't nedd...no)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.