Wysłany: 2018-05-19, 11:30
AkossPL
Wiek: 25 Na forum: 4079 dni Posty: 140
Nick w MP: AkossPL
Piwa : 3
function dbGet (...)
if not {...} then return end
local stringe = dbPrepareString ( DBHandler ,...)
local query = dbQuery ( DBHandler , stringe )
local result = dbPoll ( query , - 1 )
return result
end
B??dy w konsolce
[11:32] WARNING: [New WorldV3]/[BAZA]/ogrpg-db/s_db.lua:25: Bad argument @ 'd
bPrepareString' [Expected db-connection at argument 1, got boolean]
[11:32] WARNING: [New WorldV3]/[BAZA]/ogrpg-db/s_db.lua:26: Bad argument @ 'd
bQuery' [Expected db-connection at argument 1, got boolean]
[11:32] WARNING: [New WorldV3]/[BAZA]/ogrpg-db/s_db.lua:27: Bad argument @ 'd
bPoll' [Expected db-query at argument 1, got boolean]
Wysłany: 2018-05-19, 12:07
CjPomarancza
:-)
Wiek: 17 Na forum: 3183 dni Posty: 90
Piwa : 12
Nie ma ustanowionego DBHandler, skrypt nie wie co to jest.
Podpis
Pomogłem? Doceń mnie i postaw
Wysłany: 2018-05-19, 17:57
Ciastuuś
Truck soon...
Wiek: 26 Na forum: 3071 dni Posty: 799
Nick w MP: Ciastuuś
Piwa : 4297
Poka? sw?j ca?y kod, i poczytaj o
Więcej informacji znajdziesz w Wikipedii MTA: dbConnect
Wysłany: 2018-05-20, 09:03
AkossPL
Wiek: 25 Na forum: 4079 dni Posty: 140
Nick w MP: AkossPL
Piwa : 3
--[[
Resource : OURGame v2
Developers : Split < split . programista @ gmail . com >
You have no right to use this code without my permission .
( c ) 2015 < split . programista @ gmail . com >. All rights reserved .
]]
-- Settings
DBHandler = nil
DBName = "db_33192"
DBUser = "db_33192"
DBPass = ""
DBHost = "94.23.90.14"
-- Functions
function dbSet (...)
if not {...} then return end
local stringe = dbPrepareString ( DBHandler ,...)
local query = dbExec ( DBHandler , stringe )
return query
end
function dbGet (...)
if not {...} then return end
local stringe = dbPrepareString ( DBHandler ,...)
local query = dbQuery ( DBHandler , stringe )
local result = dbPoll ( query , - 1 )
return result
end
addEventHandler ( "onResourceStart" , resourceRoot , function()
DBHandler = dbConnect ( "mysql" , "dbname=" .. DBName .. ";host=" .. DBHost .. "" , DBUser , DBPass , "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_33192"
local SQL_PASSWD = ""
local SQL_DB = "db_33192"
local SQL_HOST = ""
local SQL_PORT = 3306
local root = getRootElement ()
local SQL
local function connect ()
SQL = mysql_connect ( SQL_HOST , SQL_LOGIN , SQL_PASSWD , SQL_DB , SQL_PORT )
if ( not SQL ) then
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 ( keepAlive , 30000 , 0 )
end )
function esc ( value )
return mysql_escape_string ( SQL , value )
end
function pobierzTabeleWynikow ( query )
local result = mysql_query ( SQL , query )
if ( not result ) then
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 result ) then 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 ( result ) then 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 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
function getSQLLink ()
return SQL
end
Wysłany: 2018-05-20, 16:00
Kuks*
Wiek: 15 Na forum: 3030 dni Posty: 246
Nick w MP: Kuks*
Piwa : 2208
AkossPL , Cytat: Expected db-connection at argument 1, got boolean
Nie jeste? po??czony z baz?...
Tagi: mysql :: nie :: działa
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: