Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local SQL
- local function connect()
- -- w ponizszej linii uzupelnij dane autoryzacji
- SQL = dbConnect("mysql", "dbname=db_41935;host=87.98.236.134", "db_41935","******************","share=1")
- if (not SQL) then
- outputServerLog("BRAK POLACZENIA Z BAZA DANYCH!")
- else
- zapytanie("SET NAMES utf8;")
- end
- end
- addEventHandler("onResourceStart",resourceRoot, connect)
- function pobierzTabeleWynikow(...)
- local h=dbQuery(SQL,...)
- if (not h) then
- return nil
- end
- local rows = dbPoll(h, -1)
- return rows
- end
- function pobierzWyniki(...)
- local h=dbQuery(SQL,...)
- if (not h) then
- 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 result) then return nil end
- local tabela={}
- while true do
- local row = mysql_fetch_row(result)
- if (not row) then break end
- table.insert(tabela,row)
- end
- mysql_free_result(result)
- return tabela
- end
Add Comment
Please, Sign In to add comment