DISQUS

Building Browsergames: Building Browsergames: Implementing a flexible stats system (PHP)

  • sHyuAn · 5 months ago
    "SELECT value FROM user_stats WHERE stat_id = (SELECT id FROM stats WHERE display_name = <foo> OR short_name = <foo>) AND user_id = <bar>"

    when i put this into sql query, it shows me the error message as below:

    "MySQL said:

    #1064 - 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 '<foo> OR short_name = <foo>) AND user_id = <bar>
    LIMIT 0, 30' at line 1"

    what should i do?
  • Luke · 1 month ago
    You need to actually put values into the <foo> and <bar> portions - if you read a little further, the code to do that is later on.
  • sHyuAn · 5 months ago
    "SELECT value FROM user_stats WHERE stat_id = (SELECT id FROM stats WHERE display_name = <foo> OR short_name = <foo>) AND user_id = <bar>"

    i have inserted this into sql query.. however, the error message came out as below:

    "MySQL said:

    #1064 - 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 '<foo> OR short_name = <foo>) AND user_id = <bar>
    LIMIT 0, 30' at line 1"

    what should I do now?
  • Luke · 4 months ago
    You're missing the string formatting that puts arguments into your SQL
    statement - add that, and you should be good to go.