Update Database

Discussion in 'PHP' started by Omzy, Feb 1, 2009.

  1. #1
    I'm trying to build a front-end for my database, I've got it to display the data from the database in input fields and I have put an 'Update' button next to each input field. I want to be able to edit any of these fields and then clicking on its corresponding 'Update' button should update that field only in the database.

    How do I go about doing this?
     
    Omzy, Feb 1, 2009 IP
  2. Kaizoku

    Kaizoku Well-Known Member

    Messages:
    1,261
    Likes Received:
    20
    Best Answers:
    1
    Trophy Points:
    105
    #2
    I would suggest you not re-invent the wheel, use phpmyadmin.
     
    Kaizoku, Feb 1, 2009 IP
  3. Omzy

    Omzy Peon

    Messages:
    249
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    OK but this is also going to be a customer front end too, I would like to them to log in and update their details in the database.
     
    Omzy, Feb 1, 2009 IP
  4. hassanahmad1

    hassanahmad1 Active Member

    Messages:
    150
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    60
    #4
    use a query something like:
    UPDATE tablename SET fieldname1 = value, fieldname2 = value2 WHERE id = recordnumber
     
    hassanahmad1, Feb 1, 2009 IP
  5. shallowink

    shallowink Well-Known Member

    Messages:
    1,218
    Likes Received:
    64
    Best Answers:
    2
    Trophy Points:
    150
    #5
    write the update script so it accepts an argument/parameter in the url like update.php?id=0009 with the rest of the information. That would use GET method. If you wanted to use POST (to keep the data secure), you would have to generate a form for each row of data.
     
    shallowink, Feb 1, 2009 IP
  6. mrmaf

    mrmaf Peon

    Messages:
    41
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #6
    mrmaf, Feb 2, 2009 IP
  7. Omzy

    Omzy Peon

    Messages:
    249
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    mrmaf - thanks but that's updating the whole row if if you only edit one field - what if i want to update just that one field in the row?
     
    Omzy, Feb 3, 2009 IP