SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Evangelist Raining_Curses's Avatar
    Join Date
    May 2005
    Posts
    560
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Problem with query....

    Hi all,

    Im having problems with this query code:

    PHP Code:
    $sql "UPDATE tblMessages SET read = 1 WHERE id = '".$aMessage['id']."'";
                        
    mysql_query($sql) or die(mysql_error()); 
    It just won't work, this is the error that it is outputting:

    Code:
    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 'read = 1 WHERE id = '70'' at line 1
    I have checked that $aMessage['id'] is set........what could be the problem?

    Thanks,
    Raining
    www.thetrial.staronesw.com
    Check out my online text based rpg (In development!!)

  2. #2
    SitePoint Enthusiast shn's Avatar
    Join Date
    Jan 2006
    Location
    Munich DE
    Posts
    79
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    READ is a reserved word, try
    Code:
    UPDATE tblMessages SET `read` = 1 [...]
    (note the backticks)
    Patrick

  3. #3
    SitePoint Evangelist Raining_Curses's Avatar
    Join Date
    May 2005
    Posts
    560
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok then, thanks. I didnt know read was a reserved word
    www.thetrial.staronesw.com
    Check out my online text based rpg (In development!!)


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
  •