Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SQL=nil
- DBName="m8898_vuzzu"
- DBUser="m8898_vuzzu"
- DBPass="z8S5Mm15Yc9GUUXWHAMc"
- DBHost="mysql.ct8.pl"
- -- Functions
- function dbSet(...)
- if not {...} then return end
- local qh = dbQuery(SQL, ...)
- if not qh then return false end
- local result, num_affected_rows, last_insert_id = dbPoll(qh, -1)
- return result, num_affected_rows, last_insert_id
- end
- function dbGet(...)
- if not {...} then return end
- local stringe=dbPrepareString(SQL,...)
- local query=dbQuery(SQL, stringe)
- local result,num_affected_rows, last_insert_id =dbPoll(query, -1)
- return result
- end
- 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
- addEventHandler("onResourceStart", resourceRoot, function()
- SQL=dbConnect("mysql", "dbname="..DBName..";host="..DBHost.."", DBUser, DBPass, "share=1;autoreconnect=1")
- if SQL then
- outputDebugString("* Połączono pomyślnie! (MySQL)")
- dbSet("SET NAMES utf8")
- else
- outputDebugString("* Brak połączenia! (MySQL)")
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement