Skip to main content
June 16, 2011
Answered

How to update ALL records when inserting new image

  • June 16, 2011
  • 1 reply
  • 223 views

I have categories and subcategories and they contain images. The images are in db with an order number, the lowest number is shown first on the website

When I insert images (i have a multiple image uploader) all order numbers need update. WHen I insert for exemple 4 images, these 4 image have order 1,2,3,4 and the order of images already in db (for that category) need to become current order number + 4 and I don't know how to do this.

Anyone that can point me in the right direction?

Bianca

    This topic has been closed for replies.
    Correct answer Dan_Bracuk

    I suggest a different approach.

    If you are timestamping your db records, use that field to determine the order.  However, a simple update query will work.

    update yourtable

    set field = field + 4

    1 reply

    Dan_BracukCorrect answer
    Inspiring
    June 16, 2011

    I suggest a different approach.

    If you are timestamping your db records, use that field to determine the order.  However, a simple update query will work.

    update yourtable

    set field = field + 4