Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2017-04-21, 18:57


Pypad







Wiek: 25
Na forum: 3523 dni
Posty: 17
Nick w MP: majKi.

Piwa: 38

Respekt: 40

[2017-04-21 18:57] WARNING: [skrypty_glowne]/ogrpg-db/s_db.lua:25: Bad argument @ 'dbPrepareString' [Expected db-connection at argument 1, got boolean]
[2017-04-21 18:57] WARNING: [skrypty_glowne]/ogrpg-db/s_db.lua:26: Bad argument @ 'dbQuery' [Expected db-connection at argument 1, got boolean]
[2017-04-21 18:57] WARNING: [skrypty_glowne]/ogrpg-db/s_db.lua:27: Bad argument @ 'dbPoll' [Expected db-query at argument 1, got boolean]

Podczas rejestrowanie, wyskakuj? mi to.
Prosze o pomoc

Podpis
Seven Life!


Proces ukończenia projektu [ 60% ]
Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-04-21, 19:00


Gravgor







Wiek: 22
Na forum: 3619 dni
Posty: 380
Nick w MP: 1944

Piwa: 702

Respekt: 57,8

Zle wpisales dane.

Podpis
Portfolio marceliborowczak.me
Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-04-21, 19:13


Pypad







Wiek: 25
Na forum: 3523 dni
Posty: 17
Nick w MP: majKi.

Piwa: 38

Respekt: 40

?le?
-- Settings
DBHandler=nil
DBName="db_23548"
DBUser="db_23548"
DBPass="xs********"
DBHost="3rdp.ServerProject.pl"

-- Functions
function dbSet(...)
    if not {...} then return end
    local stringe=dbPrepareString(DBHandler,...)
    local query=dbExec(DBHandlerstringe)
    return query
end

function dbGet(...)
    if not {...} then return end
    local stringe=dbPrepareString(DBHandler,...)
    local query=dbQuery(DBHandlerstringe)
    local result=dbPoll(query, -1)
    return result
end


addEventHandler("onResourceStart"resourceRoot, function()
    DBHandler=dbConnect("mysql""dbname="..DBName..";host="..DBHost..""DBUserDBPass"share=1;autoreconnect=1")
    if DBHandler then
        outputDebugString("* Connect to server MYSQL...")
        dbSet("SET NAMES utf8")
    else
        outputDebugString("* No Connecting to server MYSQL..")
    end
end)


local SQL_LOGIN="db_23548"
local SQL_PASSWD="xs*******"
local SQL_DB="db_23548"
local SQL_HOST="3rdp.ServerProject.pl"
local SQL_PORT=3306

local root getRootElement()

local SQL

local function connect()
    SQL mysql_connect(SQL_HOSTSQL_LOGINSQL_PASSWDSQL_DBSQL_PORT)
    if (not SQLthen
        outputServerLog("BRAK POLACZENIA Z BAZA DANYCH!")
    else
        --mysql_query(SQL,"SET NAMES utf8")
        --outputServerLog("Modul mysql polaczony!")
    end

end


local function keepAlive()
    if (not mysql_ping(SQL)) then
        outputServerLog("Zerwane polaczenie z baza danych, nawiazywanie...")
        connect()
    end
end
addEventHandler("onResourceStart",getResourceRootElement(),function()
    connect()
    setTimer(keepAlive300000)
end)

function esc(value)
    return mysql_escape_string(SQL,value)
end

function pobierzTabeleWynikow(query)
    local result=mysql_query(SQL,query)
    if (not resultthen
        outputDebugString("mysql_query failed: (" .. mysql_errno(SQL) .. ") " .. mysql_error(SQL))
        outputServerLog("mysql_query failed: (" .. mysql_errno(SQL) .. ") " .. mysql_error(SQL))
        return nil
    end
    local tabela={}
    for result,row in mysql_rows_assoc(result) do
        table.insert(tabela,row)
    end
    mysql_free_result(result)
    return tabela
end

function pobierzWyniki(query)
    local result=mysql_query(SQL,query)
    if (not resultthen return nil end
    row mysql_fetch_assoc(result)
    mysql_free_result(result)
    return row
end


function zapytanie(query)
    local result=mysql_query(SQL,query)
    if (resultthen mysql_free_result(result) return true end
    return
end

function insertID()
    return mysql_insert_id(SQL)
end

function affectedRows()
    return mysql_affected_rows(SQL)
end


function fetchRows(query)
    local result=mysql_query(SQL,query)
    if (not resultthen return nil end
    local tabela={}

    while true do
        local row mysql_fetch_row(result)
        if (not rowthen break end
        table.insert(tabela,row)
    end
    mysql_free_result(result)
    return tabela
end


function getSQLLink()
    return SQL
end


Podpis
Seven Life!


Proces ukończenia projektu [ 60% ]
Ostatnio zmieniony przez Emm 2017-06-29, 11:19, w całości zmieniany 1 raz  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-04-21, 19:14


Gravgor







Wiek: 22
Na forum: 3619 dni
Posty: 380
Nick w MP: 1944

Piwa: 702

Respekt: 57,8

Tak zle.
Host zmien na ten cyferkowy

Podpis
Portfolio marceliborowczak.me
Postaw piwo autorowi tego posta
 

 
Tagi: połączenie
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » połączenie db Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Dodaj temat do Ulubionych
Wersja do druku