Web Analytics Made Easy -
StatCounter SQL syntax error??? - CodingForum

Announcement

Collapse
No announcement yet.

SQL syntax error???

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • SQL syntax error???

    Help! Can anybody tell me why this code

    $sql_0 = "SELECT games_played, Rc, Ro, wins, loses, ties, titles FROM rating_career_test WHERE member_name = '$_POST[participant_0]'";

    is producing the following error message:

    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 'titles = 0 WHERE member_name = 'Smith, John'' at line 3

    Maybe I'm just sleep deprived, but I just don't see what could possibly be causing a syntax error.

  • #2
    echo out $sql_0 so you can see what the actual query looks like with all the PHP variables filled in.

    Comment


    • #3
      DOH!!! Seems I am sleep deprived. I was looking at the wrong snippet of code for the past hour trying to figure out what in the heck could be wrong. LOL, obviously nothing with the code I was looking at.

      Here's the code that was causing the problem:

      $sql_update_0_career = "UPDATE rating_career_test SET GAMES_PLAYED = '$total_games_played_0', RC = '$Rc_0',
      RO = '$Rc2_0', WINS = '$total_wins_0', LOSES = '$total_loses_0', TIES = '$total_ties_0', PLUS_MINUS = '$plus_minus_0'
      titles = $titles
      WHERE member_name = '$_POST[participant_0]'";

      Obviously I'm missing the , after '$plus_minus_0'

      Comment

      Working...
      X