• Quick Question! Save data to SQL
    4 replies, posted
Hello right now i finished some functions to save some sql data for my gamemode but im stuck with 1 little problem how can i Connect the SQL Database to my gmod? i mean it saves the file to the gmod DB not the one i have so HOW i make the functions save the data to my Database instead of the gmod one? [lua]function saveStat ( ply ) money = ply:GetNWInt("money") unique_id = ply:GetNWString ("SteamID") exp = ply:GetNWInt ("exp") CurLevel = ply:GetNWInt ("CurLevel") speech = ply:GetNWInt("speech") fish = ply:GetNWInt("fish") farm = ply:GetNWInt("farm") sql.Query("UPDATE player_skills SET speech = "..speech..", fish = "..fish..", farm = "..farm.." WHERE unique_id = '"..unique_id.."'") sql.Query("UPDATE player_info SET money = "..money..",exp = "..exp..", CurLevel = "..CurLevel..", WHERE unique_id = '"..unique_id.."'") ply:ChatPrint("Your Stats have been saved") end[/lua] PD: if anyone can help me with this i would appreciate it!
You use a [url=http://www.facepunch.com/forums/70-Binary-Modules-(dlls)]binary module[/url]: like [url=http://www.facepunch.com/threads/933647-Gm_MySql-v1.0-OO-edition.]MySQLOO[/url]
ahhh crap so that means that now i have to rewrrite my code to work with MySQLOO?
[QUOTE=werewolf0020;27568520]ahhh crap so that means that now i have to rewrrite my code to work with MySQLOO?[/QUOTE] you did not write that, its from: [url]http://wiki.garrysmod.com/?title=LUA:SQLite_Tutorial:_Part_3[/url] and yes, SQLITE and mysql is two different things, its similiar to eachother but different structures, mysql got more features tough, i think.
sorry i forgot to say that i only modified the code from that tutorial
Sorry, you need to Log In to post a reply to this thread.