SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Mar 2010
    Posts
    31
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Modify db via php/html form

    Hello to everyone!
    I need a mode to modify (edit) and update the db via a php/html form. I have now a mode to insert and delete form but i don;t know how to proceed for a update form. Can someone help me please?

    Thank you in advance!

  2. #2
    rajug.replace('Raju Gautam'); bronze trophy Raju Gautam's Avatar
    Join Date
    Oct 2006
    Location
    Kathmandu, Nepal
    Posts
    4,013
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Kleidi View Post
    Hello to everyone!
    I need a mode to modify (edit) and update the db via a php/html form. I have now a mode to insert and delete form but i don;t know how to proceed for a update form. Can someone help me please?

    Thank you in advance!
    How do you mean by 'mode'? Actually to modify row(s) in database (i presume you are using mysql), you just need to prepare a update statement and execute with a php function mysql_query(). If you are not known to the update statement it looks like this.
    PHP Code:
    $id 10;// this value can be dynamic by passing from query string or form
    $sql "UPDATE tblname SET columname='NewValue', columnname2='NewValue' WHERE id=$id";
    mysql_query($sql) or die(mysql_error()); 
    This will update a single record in the table. Where clause will determine what rows to update and you can put various number of columns.
    Mistakes are proof that you are trying.....
    ------------------------------------------------------------------------
    PSD to HTML - SlicingArt.com | Personal Blog | ZCE - PHP 5


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •