Wysłany: 2016-06-26, 17:05
CzarnaKobra
Wiek: 30 Na forum: 4183 dni Posty: 59
Nick w MP: CzarnaKobra
Piwa : 1
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_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: 2016-06-26, 18:20
Komel123
Wiek: 21 Na forum: 3722 dni Posty: 54
Nick w MP: incognito
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.
Wysłany: 2016-06-26, 18:26
CzarnaKobra
Wiek: 30 Na forum: 4183 dni Posty: 59
Nick w MP: CzarnaKobra
Piwa : 1
up ja to wiem usun??em by nie by?o wida? pas?w
Wysłany: 2016-06-26, 18:42
TheTroll
Pan Majster
Wiek: 38 Na forum: 4764 dni Posty: 219
Nick w MP: TheTroll
Piwa : 1114
Wysłany: 2016-06-26, 21:40
CzarnaKobra
Wiek: 30 Na forum: 4183 dni Posty: 59
Nick w MP: CzarnaKobra
Piwa : 1
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)
Wysłany: 2016-06-27, 12:27
iNev.
Wiek: 24 Na forum: 3950 dni Posty: 94
Nick w MP: iNev
Piwa : 953
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?
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
Modu?u MySQL ju? si? nie u?ywa, bo ma du?o dziur i jest ma?o odporny na SQL injecting. Uzywaj funkcji DB.
Wysłany: 2016-06-27, 13:16
CzarnaKobra
Wiek: 30 Na forum: 4183 dni Posty: 59
Nick w MP: CzarnaKobra
Piwa : 1
up^ iNev jak pod nowe zrobi??
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
Wysłany: 2016-06-27, 14:52
CzarnaKobra
Wiek: 30 Na forum: 4183 dni Posty: 59
Nick w MP: CzarnaKobra
Piwa : 1
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 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
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
Wysłany: 2016-06-27, 19:43
CzarnaKobra
Wiek: 30 Na forum: 4183 dni Posty: 59
Nick w MP: CzarnaKobra
Piwa : 1
Tagi: db/mysql
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: