kuba90pl Posted December 22, 2011 Posted December 22, 2011 function zalogujGracza(nazwa,haslo) local dane=dbPoll(dbQuery( funbox_db, "SELECT haslo FROM gracze WHERE nazwa='"..nazwa.."'" ), -1) outputChatBox(unpack(dane)) end addEvent("zalogujGracza",true) addEventHandler("zalogujGracza",root,zalogujGracza) mysql table: its show error at outputChatBox . so how to get this value? nazwa is right .
kuba90pl Posted December 22, 2011 Author Posted December 22, 2011 so if someone didnt understand what i wanted: i just want to get a "haslo" value from a player with specific "nazwa" and i just dont know how
Mefisto_PL Posted December 22, 2011 Posted December 22, 2011 Napiszę Ci to po polsku bo jesteś polakiem.. Przeczytaj to: https://wiki.multitheftauto.com/wiki/OutputChatBox Masz tu cały opis jak czego użyć. Według mnie to powinieneś podzielić to na kilka grup, a mianowicie np. outputChatBox("Blah Blah"..dane1.." Blah blah", 255, 0, 255, true)
kuba90pl Posted December 22, 2011 Author Posted December 22, 2011 Napiszę Ci to po polsku bo jesteś polakiem.. Przeczytaj to: https://wiki.multitheftauto.com/wiki/OutputChatBox Masz tu cały opis jak czego użyć. Według mnie to powinieneś podzielić to na kilka grup, a mianowicie np. outputChatBox("Blah Blah"..dane1.." Blah blah", 255, 0, 255, true) lolw. ja to wiem , mi chodzi o to ze problem polega na pobieraniu danych z mysql. eng: i know outputchatbox , but there's problem with getting data from mysql
Mefisto_PL Posted December 22, 2011 Posted December 22, 2011 no to mówię.. musisz dodać opcję mySQL i podzielić to na grupy tak jak powiedziałem.. zrób najpierw zapisywanie danych w bazie MySQL a potem podziel to na grupy . I say .. you must add the mySQL and divide it into groups of like I said .. make a first write data in the MySQL database and then divide it into groups.
kuba90pl Posted December 22, 2011 Author Posted December 22, 2011 mi ogolnie chodzi o przyklad jak pobrac dane i odczytac je tak abym mogl je potem uzyc. eng: i just want example how to get data and then use it
Castillo Posted December 22, 2011 Posted December 22, 2011 (edited) function zalogujGracza(nazwa,haslo) local dane=dbPoll(dbQuery( funbox_db, "SELECT haslo FROM gracze WHERE nazwa='"..nazwa.."'" ), -1) outputChatBox(tostring(dane[1].serial)) end addEvent("zalogujGracza",true) addEventHandler("zalogujGracza",root,zalogujGracza) Edited December 23, 2011 by Guest
kuba90pl Posted December 22, 2011 Author Posted December 22, 2011 function zalogujGracza(nazwa,haslo) local dane=dbPoll(dbQuery( funbox_db, "SELECT haslo FROM gracze WHERE nazwa='"..nazwa.."'" ), -1) outputChatBox(tostring(dane.serial)) end addEvent("zalogujGracza",true) addEventHandler("zalogujGracza",root,zalogujGracza) function zalogujGracza(nazwa,haslo) local dane=dbPoll(dbQuery( funbox_db, "SELECT * FROM gracze WHERE nazwa='"..nazwa.."'" ), -1) if dane then outputChatBox(tostring(dane.haslo)) end end i wanted to receive "haslo" value not serial , anyway i changed it and it still return nil
Castillo Posted December 23, 2011 Posted December 23, 2011 function zalogujGracza(nazwa, haslo) local query = dbQuery( funbox_db, "SELECT * FROM gracze WHERE nazwa=?", tostring(nazwa) ) local result, numrows, errmsg = dbPoll ( query, -1 ) if (numrows > 0) then outputChatBox(tostring(result[1].haslo)) end end
kuba90pl Posted December 23, 2011 Author Posted December 23, 2011 function zalogujGracza(nazwa, haslo) local query = dbQuery( funbox_db, "SELECT * FROM gracze WHERE nazwa=?", tostring(nazwa) ) local result, numrows, errmsg = dbPoll ( query, -1 ) if (numrows > 0) then outputChatBox(tostring(result[1].haslo)) end end BIG BEER FOR YOU ! working , thanks!
kuba90pl Posted December 23, 2011 Author Posted December 23, 2011 help , this script return true but it doesnt change value in db (haslo) function zarejestrujGracza(nazwa,haslo,email) outputChatBox(nazwa) dbFree(dbQuery ( funbox_db, "UPDATE gracze SET haslo = ? WHERE nazwa = ? " , haslo, nazwa )) outputServerLog("Rejestracja: Gracz "..nazwa.." Haslo: "..haslo.." Email: "..email.."") end addEvent("zarejestrujGracza",true) addEventHandler("zarejestrujGracza",root,zarejestrujGracza)
Castillo Posted December 23, 2011 Posted December 23, 2011 Try this, not sure (I'm tired): function zarejestrujGracza(nazwa,haslo,email) outputChatBox(tostring(nazwa)) if dbExec( funbox_db, "UPDATE `gracze` SET `haslo` = '" .. haslo .. "' WHERE `nazwa` = '" .. nazwa .."'" ) then outputServerLog("Rejestracja: Gracz "..nazwa.." Haslo: "..haslo.." Email: "..email.."") end end addEvent("zarejestrujGracza",true) addEventHandler("zarejestrujGracza",root,zarejestrujGracza)
kuba90pl Posted December 23, 2011 Author Posted December 23, 2011 Try this, not sure (I'm tired): function zarejestrujGracza(nazwa,haslo,email) outputChatBox(tostring(nazwa)) if dbExec( funbox_db, "UPDATE `gracze` SET `haslo` = '" .. haslo .. "' WHERE `nazwa` = '" .. nazwa .."'" ) then outputServerLog("Rejestracja: Gracz "..nazwa.." Haslo: "..haslo.." Email: "..email.."") end end addEvent("zarejestrujGracza",true) addEventHandler("zarejestrujGracza",root,zarejestrujGracza) its show in console "rejestracja etc" but in db still in "haslo" value is null
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