Jump to content

MYSQL select


kuba90pl

Recommended Posts

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:

90454759098602026866.jpg

its show error at outputChatBox . so how to get this value? nazwa is right .

Link to comment
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

Link to comment

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.

Link to comment
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 by Guest
Link to comment
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

Link to comment
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 

Link to comment
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!

Link to comment

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) 

51009727155850849452.jpg

Link to comment

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) 

Link to comment
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

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...