SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Enthusiast
    Join Date
    May 2001
    Location
    Atlanta
    Posts
    48
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Update in php form

    Hi,

    I want to update the fields in database from the form, and I'm writing the sql statement like this:

    $SQL = "update class set fname ='$fname, lname='$lname',dept='$dept',class_id='$class_id',phone='$phone')";
    $SQL .= "where id = $id";

    And it isn't work for me. Please help me out.
    Thank you
    Aneal

  2. #2
    SitePoint Addict manipura's Avatar
    Join Date
    Apr 2001
    Location
    Calgary,AB
    Posts
    345
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try this
    you missed a single quote on $fname
    I hate doing that

    $SQL = "update class set fname ='$fname', lname='$lname',dept='$dept',class_id='$class_id',phone='$phone')";
    $SQL .= "where id = $id";

  3. #3
    SitePoint Evangelist ucahg's Avatar
    Join Date
    Apr 2001
    Location
    Sarnia, Ontario, Canada
    Posts
    434
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    take out the closing bracket )
    Love it? Hate it? Helpful? Useless?
    Use the rate button to let me know what you think of my post!

  4. #4
    SitePoint Enthusiast drisley's Avatar
    Join Date
    Jun 2001
    Location
    Florida
    Posts
    99
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    And you'll probably need to put a space before the WHERE so that the SQL doesn't product an error. Maybe you've done this in this script already.
    David Risley
    Web Developer, Web Publisher, Blogger, Tech Dude
    PC Mechanic | WebbyOnline

  5. #5
    Victory shall be mine tubedogg's Avatar
    Join Date
    Mar 2001
    Location
    Medina, OH
    Posts
    440
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So to sum it all up

    $SQL = "update class set fname='$fname', lname='$lname',dept='$dept',class_id='$class_id',phone='$phone'";
    $SQL .= " where id='$id'";
    Kevin

  6. #6
    SitePoint Enthusiast
    Join Date
    May 2001
    Location
    Atlanta
    Posts
    48
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you guys.

    It works now I'm
    Aneal


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
  •