RastaMan Posted October 8, 2011 Posted October 8, 2011 Hello i have problem. I wrote script to mysql but this script not writes data. function saveTo() local serial = getPlayerSerial(source) local score = getPlayerName(source) local nazwa = getPlayerName(source) local skin = getElementModel(source) local kasa = getPlayerMoney(source) con = mysql_connect ( "127.0.0.1", "****", "****", "****") local res = mysql_query(con, "SELECT serial FROM gracze WHERE serial='"..serial.."'" ) if mysql_num_rows(res) >= 1 then mysql_query ( con, "UPDATE gracze SET serial='"..serial.."' nazwa='"..nazwa.."' score="..score.." skin="..skin.." kasa="..kasa.." WHERE serial='"..serial.."'" ) else mysql_query ( con, "INSERT INTO gracze VALUES ('"..serial.."', '"..nazwa.."', "..score..", "..skin..", "..kasa..")" ) end end addEventHandler("onPlayerQuit", getRootElement(), saveTo) Please help
BriGhtx3 Posted October 8, 2011 Posted October 8, 2011 function saveTo() local serial = getPlayerSerial(source) local score = getPlayerName(source) local nazwa = getPlayerName(source) local skin = getElementModel(source) local kasa = getPlayerMoney(source) con = mysql_connect ( "127.0.0.1", "****", "****", "****") local res = mysql_query(con, "SELECT serial FROM gracze WHERE serial='"..serial.."'" ) if mysql_num_rows(res) >= 1 then mysql_query ( con, "UPDATE gracze SET serial='"..serial.."', nazwa='"..nazwa.."', score="..score..", skin="..skin..", kasa="..kasa.." WHERE serial='"..serial.."'" ) else mysql_query ( con, "INSERT INTO gracze VALUES ('"..serial.."', '"..nazwa.."', "..score..", "..skin..", "..kasa..")" ) end end
RastaMan Posted October 8, 2011 Author Posted October 8, 2011 function saveTo() local serial = getPlayerSerial(source) local score = getPlayerName(source) local nazwa = getPlayerName(source) local skin = getElementModel(source) local kasa = getPlayerMoney(source) con = mysql_connect ( "127.0.0.1", "****", "****", "****") local res = mysql_query(con, "SELECT serial FROM gracze WHERE serial='"..serial.."'" ) if mysql_num_rows(res) >= 1 then mysql_query ( con, "UPDATE gracze SET serial='"..serial.."', nazwa='"..nazwa.."', score="..score..", skin="..skin..", kasa="..kasa.." WHERE serial='"..serial.."'" ) else mysql_query ( con, "INSERT INTO gracze VALUES ('"..serial.."', '"..nazwa.."', "..score..", "..skin..", "..kasa..")" ) end end Dosen't Work ;/
RastaMan Posted October 9, 2011 Author Posted October 9, 2011 In debug is 0 errors, but don't save data.
BriGhtx3 Posted October 9, 2011 Posted October 9, 2011 Are you sure, that your connecting data is right?
RastaMan Posted October 10, 2011 Author Posted October 10, 2011 Yes, I checked the login and password are correct. Mysql settings too.
novo Posted October 11, 2011 Posted October 11, 2011 Are you sure that you have the module "ml_mysql.dll" installed on your server ? The MYSQL scripts, needs that module to work. Check that. Wiki of MYSQL; https://wiki.multitheftauto.com/wiki/Modules/MTA-MySQL
RastaMan Posted October 14, 2011 Author Posted October 14, 2011 Yes, i have installed this module, but this script don't work.
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