Jump to content

updating more than one record in MySQl using PHP


gnawz

Recommended Posts

Dear PHP freaks,

 

I have a small problem.

 

I need help oh how I can be able to update more than on record and save it all in one click.

 

I need to read data from a database, say of 200 different items.

I would like to edit the price of each item but I do not want it done 1 by one.

 

I want to be able to display all items or a fragment of them (paginated. say 20 par page) each with its price in an text box, edit the price, then click save and all the item prices I have edited are saved. Same way phpmyadmin can allow one to check fields to edit, then open them in an editable display, edit them and click save or the way one can edit comments of photos in social networking utilities, then save all in one button click.

 

I will appreciate any help

Link to comment
Share on other sites

Count the number of rows your updating, sort the data into an array, and then run a while function doing the same query only updating the entry in the database based on the values in the array.

 

Does that make sense?

 

I'm not the greatest when it comes to explaining stuff.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.