Alright, so I recently began to convert my NWInt database to a MySql database. How would I go about creating a function like the following.
Anytime I try to create a function like the following it always returns with a Boolean value of "False", I'm not sure why it is doing this because my table does in fact contain the table value "Money", when I attempt to get "Money" normally without going through the function it returns the correct value.
[b] Function:[/b] Called by another function to try and receive the data.
[lua]
function GetSV(ply,arg)
if(arg[1] == nil) then return false else
return sql.Query("SELECT arg from TTCRP_PlyData WHERE SID = '"..SteamID.."'")
end
end
[/lua]
[b]Usage:[/b] MooTest "Money"
[lua]
function MooTest(ply,cmd,arg)
if(GetSV(ply,arg[1]) < 50) then print("Fail") return else
--DoStuff
end
end
concommand.Add("MooTest", MooTest)
[/lua]
Also, I apologize if the information in this topic is vague, if so needed just go ahead and ask for a more thorough description.
[lua]
function GetSV(ply,arg)
if(arg[1] == nil) then return false else
return sql.Query("SELECT arg from TTCRP_PlyData WHERE SID = '"..SteamID.."'")
end
end
[/lua]
to
[lua]
function GetSV(ply,arg)
if(arg[1] == nil) then return false else
return sql.Query("SELECT " .. arg .. " from TTCRP_PlyData WHERE SID = '"..SteamID.."'")
end
end
[/lua]
?
Nope, that didn't work. As I said, I have no idea why it isn't working, I've tried multiple different methods.
[lua]
function GetSV(ply,arg)
if(arg == nil) then return false else
return sql.Query("SELECT `"..arg.."` from TTCRP_PlyData WHERE `SID` = '"..ply:SteamID().."'")
end
end
[/lua]
?
pretty thats sqlite not mysql o.O
[QUOTE=dorfy;20752896]pretty thats sqlite not mysql o.O[/QUOTE]
Huh? What's the difference?
Sorry, you need to Log In to post a reply to this thread.