FWCentral Posted June 19, 2012 Share Posted June 19, 2012 There is an error here in the debug script : Database query failed: No such column: false Attempt to the length of local 'gname' (a boolean value) The database "Government_members" exists and so does "govName" local nam = getAccountName(getPlayerAccount(player)) local gname = executeSQLQuery("SELECT govName FROM Government_members WHERE name = ?", nam) if #gname >= 1 then Link to comment
DiSaMe Posted June 19, 2012 Share Posted June 19, 2012 Government_members is a database? AFAIK, it should be a table. Link to comment
FWCentral Posted June 19, 2012 Author Share Posted June 19, 2012 Sorry yes it's a table and the "govName" is a field but that's not the problem as far as i know. Link to comment
DiSaMe Posted June 19, 2012 Share Posted June 19, 2012 Maybe the error is about column called 'name' which you wrote after WHERE? Link to comment
FWCentral Posted June 19, 2012 Author Share Posted June 19, 2012 But the data is in the name field i can't see any problem Link to comment
DiSaMe Posted June 19, 2012 Share Posted June 19, 2012 I tested it and I see where's the problem now. You didn't put the quotes where the name gets inserted. So this should work: local gname = executeSQLQuery("SELECT govName FROM Government_members WHERE name = '?'", nam) Link to comment
StifflersMom Posted June 19, 2012 Share Posted June 19, 2012 If this is the problem, the wiki for executeSQLQuery should be updated local result = executeSQLQuery("SELECT money FROM players WHERE name=?", playerName) May be, the space between = and ? is also a problem Link to comment
DiSaMe Posted June 19, 2012 Share Posted June 19, 2012 It's not. I was learning to script in SQL yesterday and today and it works with spaces too. Link to comment
StifflersMom Posted June 19, 2012 Share Posted June 19, 2012 Then the wiki part is wrong. If you see it in "pure" sql, then you can do a "SELECT whatever FROM table where whatever = 1" This is correct for a numerical value. For Chars, Varchars or Text it should be "SELECT whatever from table where whatever = '1' " Link to comment
FWCentral Posted June 19, 2012 Author Share Posted June 19, 2012 Well this is what i use for my spawn system and it works fine; local teams = executeSQLQuery("SELECT team FROM Spawn WHERE name = ? AND city = ?",tostring(spawn), tostring( location )) Ill test the one you put Crystal and get back. Link to comment
DiSaMe Posted June 19, 2012 Share Posted June 19, 2012 Oh, if that works fine, that means the function puts the quotes automatically. But the problem in your script probably comes from getAccountName return value. From the error you wrote, it seems to return false, so the quotes aren't put around it, unlike strings. You need to check what it returns before executing the query. Link to comment
FWCentral Posted June 19, 2012 Author Share Posted June 19, 2012 Yes you are right Crystal its not the database error its the nam, function onLogin(source) -- using it like this onPlayerLogin was the problem. 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