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

Wysłany: 2016-06-26, 17:05


CzarnaKobra







Wiek: 30
Na forum: 4183 dni
Posty: 59
Nick w MP: CzarnaKobra

Piwa: 1

Respekt: 45,3

w db 3 b??d
attempt to call global 'mysql_connect' (a nil value)

Kod

local SQL_LOGIN=""
local SQL_PASSWD=""
local SQL_DB=""
local SQL_HOST=""
local SQL_PORT=

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


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-06-26, 18:20


Komel123







Wiek: 21
Na forum: 3722 dni
Posty: 54
Nick w MP: incognito



Respekt: 50

SQL_LOGIN To jest login do tej bazy, musisz mie? tam na stronie do db.
SQL_PASSW wpisujesz has?o do tej bazy danych.
SQL_DB Baza danych np. db_14621.
SQL_HOST tam masz Host i to musisz skopiowa?.
SQL_PORT port masz na stronie.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-06-26, 18:26


CzarnaKobra







Wiek: 30
Na forum: 4183 dni
Posty: 59
Nick w MP: CzarnaKobra

Piwa: 1

Respekt: 45,3

up ja to wiem usun??em by nie by?o wida? pas?w :)

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-06-26, 18:42


TheTroll

Pan Majster






Wiek: 38
Na forum: 4764 dni
Posty: 219
Nick w MP: TheTroll

Piwa: 1114

Respekt: 120
Respekt: 120

Mo?liwe ?e nie wgra?e? modu?u MySQL. Zapoznaj si? z tym poradnikiem

http://gtao.pl/tut-mysql-vt58249.htm

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-06-26, 21:40


CzarnaKobra







Wiek: 30
Na forum: 4183 dni
Posty: 59
Nick w MP: CzarnaKobra

Piwa: 1

Respekt: 45,3

up zrobi?em to mniej wiecej dzia?a lecz kolejny b??d
s_db:66: bad argument #1 to 'mysql_ping'(myshlHandler expected,got nil)

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-06-27, 12:27


iNev.







Wiek: 24
Na forum: 3951 dni
Posty: 94
Nick w MP: iNev

Piwa: 953

Respekt: 180
Respekt: 180Respekt: 180

Polecam to Ci zrobi? pod nowe funkcje MySQL, nie u?ywa si? ju? tych starych. Je?eli ju? Ci tak zale?y na starych, to wgraj modu?. Nowe tego nie wymagaj? :)

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-06-27, 12:55


Jacob

Głupiomądry






Wiek: 28
Na forum: 5502 dni
Posty: 967
Nick w MP: Jacob

Piwa: 786

Respekt: 212,3
Respekt: 212,3Respekt: 212,3

Modu?u MySQL ju? si? nie u?ywa, bo ma du?o dziur i jest ma?o odporny na SQL injecting. Uzywaj funkcji DB.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-06-27, 13:16


CzarnaKobra







Wiek: 30
Na forum: 4183 dni
Posty: 59
Nick w MP: CzarnaKobra

Piwa: 1

Respekt: 45,3

up^ iNev jak pod nowe zrobi??

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-06-27, 14:42


Jacob

Głupiomądry






Wiek: 28
Na forum: 5502 dni
Posty: 967
Nick w MP: Jacob

Piwa: 786

Respekt: 212,3
Respekt: 212,3Respekt: 212,3

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-06-27, 14:52


CzarnaKobra







Wiek: 30
Na forum: 4183 dni
Posty: 59
Nick w MP: CzarnaKobra

Piwa: 1

Respekt: 45,3

co? takiego :?

local SQL

local function connect()
    -- w ponizszej linii uzupelnij dane autoryzacji
    SQL dbConnect("mysql""dbname=db_-----;host=mysql-fr1.ServerProject.pl""db_----","------","share=1")
    if (not SQLthen
        outputServerLog("BRAK POLACZENIA Z BAZA DANYCH!")
    else
        zapytanie("SET NAMES utf8;")
    end

end

addEventHandler("onResourceStart",resourceRootconnect)

function pobierzTabeleWynikow(...)
    local h=dbQuery(SQL,...)
    if (not hthen 
        return nil
    end
    local rows dbPoll(h, -1)
    return rows
end

function pobierzWyniki(...)
    local h=dbQuery(SQL,...)
    if (not hthen 
        return nil
    end
    local rows dbPoll(h, -1)
    if not rows then return nil end
    return rows[1]
end

function zapytanie(...)
    local h=dbQuery(SQL,...)
    local result,numrows=dbPoll(h,-1)
    return numrows
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


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-06-27, 18:49


Jacob

Głupiomądry






Wiek: 28
Na forum: 5502 dni
Posty: 967
Nick w MP: Jacob

Piwa: 786

Respekt: 212,3
Respekt: 212,3Respekt: 212,3

Dok?adnie.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-06-27, 19:43


CzarnaKobra







Wiek: 30
Na forum: 4183 dni
Posty: 59
Nick w MP: CzarnaKobra

Piwa: 1

Respekt: 45,3

mo?na Lock

Postaw piwo autorowi tego posta
 

 
Tagi: db/mysql
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA 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