Wysłany: 2017-01-01, 17:03
posterr11
Wiek: 37 Na forum: 5258 dni Posty: 20
Nick w MP: Ryder
Hejka!
Mam pewien problem z GM'em It Just City. Mianowicie po skonfigurowaniu serwera i za?adowania plik?w, po wej?ciu na serwer pokazuje mi si? czarny ekran z mini map? tylko i nic nie da si? zrobi?, ewidentnie wydaje mi si?, ?e to b??d od bazy danych.
Oto jaki b??d jest w konsoli:
Kod: [2017-01-01 16] ERROR: [podstawa]/ogrpg-db/s_db.lua:54: attempt to call global 'mysql_connect' (a nil value)
Wysłany: 2017-01-01, 17:06
xJakob
Wiek: 31 Na forum: 3661 dni Posty: 164
Nick w MP: tylkoyolo
Piwa : 984
posterr11 , b??d w po??czeniu mysql.
Spr?buj ten kod mo?e
-- Ustawienia po ?? czenia
DBHandler = nil
DBName = "twoja"
DBUser = "twoja"
DBPass = "twoja"
DBHost = "twoja"
-- Funkcje
function dbSet (...)
if not {...} then return end
local query = dbExec ( DBHandler , ...)
return query
end
function dbGet (...)
if not {...} then return end
local query = dbQuery ( DBHandler , ...)
local result = dbPoll ( query , - 1 )
return result
end
addEventHandler ( "onResourceStart" , resourceRoot , function()
DBHandler = dbConnect ( "mysql" , "dbname=" .. DBName .. ";host=" .. DBHost .. "" , DBUser , DBPass , "share=1" )
if DBHandler then
outputDebugString ( "* Connect to server MYSQL..." )
else
outputDebugString ( "* No Connecting to server MYSQL.." )
end
end )
local SQL_LOGIN = "twoja"
local SQL_PASSWD = "twoja"
local SQL_DB = "twoja"
local SQL_HOST = "twoja"
local SQL_PORT = twoja
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
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: 2017-01-01, 17:26
posterr11
Wiek: 37 Na forum: 5258 dni Posty: 20
Nick w MP: Ryder
"xJakob" napisał/a :posterr11 , b??d w po??czeniu mysql.
Spr?buj ten kod mo?e
-- Ustawienia po ?? czenia
DBHandler = nil
DBName = "twoja"
DBUser = "twoja"
DBPass = "twoja"
DBHost = "twoja"
-- Funkcje
function dbSet (...)
if not {...} then return end
local query = dbExec ( DBHandler , ...)
return query
end
function dbGet (...)
if not {...} then return end
local query = dbQuery ( DBHandler , ...)
local result = dbPoll ( query , - 1 )
return result
end
addEventHandler ( "onResourceStart" , resourceRoot , function()
DBHandler = dbConnect ( "mysql" , "dbname=" .. DBName .. ";host=" .. DBHost .. "" , DBUser , DBPass , "share=1" )
if DBHandler then
outputDebugString ( "* Connect to server MYSQL..." )
else
outputDebugString ( "* No Connecting to server MYSQL.." )
end
end )
local SQL_LOGIN = "twoja"
local SQL_PASSWD = "twoja"
local SQL_DB = "twoja"
local SQL_HOST = "twoja"
local SQL_PORT = twoja
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
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
Dzi?ki, ale po wej?ciu na serwer nadal nic si? nie dzieje.
Wysłany: 2017-01-01, 17:39
xJakob
Wiek: 31 Na forum: 3661 dni Posty: 164
Nick w MP: tylkoyolo
Piwa : 984
Poka? kod jaki masz
I czy zmienia?e? nazw? folderu
Tagi: połączenie :: mysql
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: