zixxonx Posted January 4, 2014 Share Posted January 4, 2014 local query = mysql_query(baza, "SELECT * FROM mapy WHERE map="..mapName) if(result and mysql_num_rows( result ) > 0) then local rows = mysql_fetch_assoc(result) mapinfo.map.firstplayed = rows['firsplayed'] or timestamp mapinfo.map.played = rows['total'] or 0 mapinfo.map.rate = rows['rate'] or 0 mysql_query(baza, "UPDATE mapy SET lastplayed="..timestamp..",total=total+1 WHERE map="..mapName.."") else local mapa = mapName local autor = mapInfo.author local baxza = mysql_query(baza, "INSERT INTO `mapy` (map, author, firstplayed, lastplayed) VALUES ("..mapa..", "..autor..", "..timestamp..", "..timestamp..")") That's a piece of my code. It should work good for me but it wont, when this query is executed: local query = mysql_query(baza, "SELECT * FROM mapy WHERE map="..mapName Im getting a mysql error: unknown column (there is my map name) in where clause, i did adding the map but it wont add cuz this error. Any1 know how can i do it? Link to comment
xXMADEXx Posted January 4, 2014 Share Posted January 4, 2014 Use SELECT * FROM mapy WHERE map=\""..mapName.."\" Link to comment
zixxonx Posted January 5, 2014 Author Share Posted January 5, 2014 Now that local baxza = mysql_query(baza, "INSERT INTO `mapy` (map, author, firsplayed, lastplayed) VALUES ( map="..mapa..", \""..ktostworzyl.."\", "..timestamp..", "..timestamp..")") unknown column 'bandito' in field list bandito is map name... i did \""..map.."\" but instead of putting nam name it puts 0 in map column... the type of column is "TEXT", should it be varchar or something? I'll try and edit this post. edit: varchar isnt working... edit2: i did it: local baxza = mysql_query(baza, "INSERT INTO mapy (map, author, firsplayed, lastplayed) VALUES ( map=\""..mapa.."\", \""..ktostworzyl.."\", "..timestamp..", "..timestamp..")") and thats error [2014-01-05 07:04:56] INFO: 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 'the Dam, "Ransom", 1388905496, 1388905496)' at line 1 Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now