SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast
    Join Date
    Aug 2004
    Location
    US
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Problem with Query using PHP

    i'm trying to update a mysql table using this query,

    $sql4 = mysql_query("UPDATE subp SET " .
    "agm='$agm', " .
    "coach='$coach', " .
    "empid='$empid', " .
    "name='$empname', " .
    "date='$today', " .
    "nb='$htmlnb', " .
    "bb='$htmlbb', " .
    "hsio='$htmlhsio', " .
    "WHERE date='$today' AND empid='$empid'");

    and everytime the query parses, i get this error:

    Error performing query :You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE date='2004-08-11' AND empid='11112'' at line 1

    i'm stumped at this one.. any help would be greatly appreciated.
    TIA

  2. #2
    SitePoint Wizard Lats's Avatar
    Join Date
    Jun 2003
    Location
    Melbourne, AU
    Posts
    1,142
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try this...
    PHP Code:
    $sql4 mysql_query("UPDATE subp SET 
    agm='
    $agm',  
    coach='
    $coach',
    empid='
    $empid', 
    name='
    $empname', 
    date='
    $today', 
    nb='
    $htmlnb', 
    bb='
    $htmlbb', 
    hsio='
    $htmlhsio'
    WHERE date='
    $today' AND empid='$empid'"); 
    Lats...

  3. #3
    SitePoint Enthusiast
    Join Date
    Aug 2004
    Location
    US
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks for the quick reply, but still gives me the same error

  4. #4
    SitePoint Enthusiast
    Join Date
    Aug 2004
    Location
    US
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    actually, i just got it to work, thanks for your help, it was a syntax error on my end, but i do appreciate all your help. thank you so much!

  5. #5
    SitePoint Wizard Lats's Avatar
    Join Date
    Jun 2003
    Location
    Melbourne, AU
    Posts
    1,142
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Good to hear that it's working for you
    Lats...


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
  •