Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2016-04-16, 14:43


Demic

Lua&Mapping






Wiek: 29
Na forum: 4247 dni
Posty: 63
Nick w MP: Demic

Piwa: 620

Respekt: 70

http://static.pokazywarka...16-14-31-05.jpg
Witam mam problem z po??czeniem serwera z baz? danych o co chodzi w tym b??dzie w debugu?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-04-16, 15:06


AteX







Wiek: 26
Na forum: 4015 dni
Posty: 927
Nick w MP: #AteX

Piwa: 8360

Respekt: 775,3
Respekt: 775,3Respekt: 775,3

Nie masz takiej funkcji jak mysql_connect, a przynajmniej jej nie wykrywa lub w mecie nie jest wpisana strona serwera. Mo?esz jeszcze nie posiada? modu?u MySQL.

Podpis
MultiTheftAuto++ dla MTA 1.5.7 już dostępne.
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-04-16, 20:10


Demic

Lua&Mapping






Wiek: 29
Na forum: 4247 dni
Posty: 63
Nick w MP: Demic

Piwa: 620

Respekt: 70

@AteX jak? t? funkcje doda?/napisa? ?

Podpis
<[email protected]>
warsaw-life.pl
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-04-16, 20:17


marcin778

Krytyk serwerów MTA






Wiek: 24
Na forum: 4149 dni
Posty: 2268
Nick w MP: Marcineg

Piwa: 4662

Respekt: 1436,8
Respekt: 1436,8

Podpis
Moje prace: https://www.youtube.com/c...MuaWGHPp1mhlGnw

-- obecnie
-- obecnie
-- dawniej
-- dawniej
-- dawniej
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-04-17, 10:32


Demic

Lua&Mapping






Wiek: 29
Na forum: 4247 dni
Posty: 63
Nick w MP: Demic

Piwa: 620

Respekt: 70

Gdzie mam dopisa? t? funkcje ?

Podpis
<[email protected]>
warsaw-life.pl
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-04-17, 14:10


Retrok







Wiek: 27
Na forum: 3734 dni
Posty: 58
Nick w MP: Retrok

Piwa: 4

Respekt: 50

Je?eli posiadasz VPS'A to zapewne b?dziesz musia? dogra? liby.

Podpis
Pomogłem?? daj browca bo suszy!
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-04-17, 20:15


Demic

Lua&Mapping






Wiek: 29
Na forum: 4247 dni
Posty: 63
Nick w MP: Demic

Piwa: 620

Respekt: 70

@ Marcin

Cytat:

-- connection settings
-- global things.
local MySQLConnection = nill
local resultPool = { }
local sqllog = false
local countqueries = 0

-- connectToDatabase - Internal function, to spawn a DB connection
function connectToDatabase(res)
MySQLConnection =mysql_connect(get("mysql.mysql-ols1.ServerProject.pl"), get("mysql.db_16371"), get("mysql.xxxx"), get("mysql.db_16371"), 3306)

if (not MySQLConnection) then
if (res == getThisResource()) then
cancelEvent(true, "Cannot connect to the database.")
end
return nil
end

return nil
end
addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), connectToDatabase, false)

-- destroyDatabaseConnection - Internal function, kill the connection if theres one.
function destroyDatabaseConnection()
if (not MySQLConnection) then
return nil
end
mysql_close(MySQLConnection)
return nil
end
addEventHandler("onResourceStop", getResourceRootElement(getThisResource()), destroyDatabaseConnection, false)

-- do something usefull here
function logSQLError(str)
local message = str or 'N/A'
outputDebugString("MYSQL ERROR "..mysql_errno(MySQLConnection) .. ": " .. mysql_error(MySQLConnection))
--exports['logs']:logMessage("MYSQL ERROR :O! [QUERY] " .. message .. " [ERROR] " .. mysql_errno(MySQLConnection) .. ": " .. mysql_error(MySQLConnection), 24)
end

function getFreeResultPoolID()
local size = #resultPool
if (size == 0) then
return 1
end
for index, query in ipairs(resultPool) do
if (query == nil) then
return index
end
end
return (size + 1)
end

------------ EXPORTED FUNCTIONS ---------------

function ping()
if (not MySQLConnection) then
return false
end

if (mysql_ping(MySQLConnection) == false) then
-- FUU, NO MOAR CONNECTION
destroyDatabaseConnection()
connectToDatabase(nil)
if (not MySQLConnection) then
return false
end
if (mysql_ping(MySQLConnection) == false) then
logSQLError()
return false
end

return true
end

return true
end


function escape_string(str)
if (ping()) then
return mysql_escape_string(MySQLConnection, str)
end
return false
end

function query(str)
if sqllog then
exports['logs']:logMessage(str, 24)
end
countqueries = countqueries + 1

if (ping()) then
local result = mysql_query(MySQLConnection, str)
if (not result) then
logSQLError(str)
return false
end

local resultid = getFreeResultPoolID()
resultPool[resultid] = result
return resultid
end
return false
end

function unbuffered_query(str)
if sqllog then
exports['logs']:logMessage(str, 24)
end
countqueries = countqueries + 1

if (ping()) then
local result = mysql_unbuffered_query(MySQLConnection, str)
if (not result) then
logSQLError(str)
return false
end

local resultid = getFreeResultPoolID()
resultPool[resultid] = result
return resultid
end
return false
end

function query_free(str)
local queryresult = query(str)
if not (queryresult == false) then
free_result(queryresult)
return true
end
return false
end

function rows_assoc(resultid)
if (not resultPool[resultid]) then
return false
end
return mysql_rows_assoc(resultPool[resultid])
end

function fetch_assoc(resultid)
if (not resultPool[resultid]) then
return false
end
return mysql_fetch_assoc(resultPool[resultid])
end

function free_result(resultid)
if (not resultPool[resultid]) then
return false
end
mysql_free_result(resultPool[resultid])
table.remove(resultPool, resultid)
return nil
end

-- incase a nub wants to use it, FINE
function result(resultid, row_offset, field_offset)
if (not resultPool[resultid]) then
return false
end
return mysql_result(resultPool[resultid], row_offset, field_offset)
end

function num_rows(resultid)
if (not resultPool[resultid]) then
return false
end
return mysql_num_rows(resultPool[resultid])

end

function insert_id()
return mysql_insert_id(MySQLConnection) or false
end

function query_fetch_assoc(str)
local queryresult = query(str)
if not (queryresult == false) then
local result = fetch_assoc(queryresult)
free_result(queryresult)
return result
end
return false
end

function query_rows_assoc(str)
local queryresult = query(str)
if not (queryresult == false) then
local result = rows_assoc(queryresult)
free_result(queryresult)
return result
end
return false
end

function query_insert_free(str)
local queryresult = query(str)
if not (queryresult == false) then
local result = insert_id()
free_result(queryresult)
return result
end
return false
end

function escape_string(str)
return mysql_escape_string(MySQLConnection, str)
end

function debugMode()
if (sqllog) then
sqllog = false
else
sqllog = true
end
return sqllog
end

function returnQueryStats()
return countqueries
-- maybe later more
end


Cytat:

username = "db_16371"
password = "xxxxx"
db = "db_16371"
host = "mysql-ols1.ServerProject.pl"
port = 3306

function getMySQLUsername()
return username
end

function getMySQLPassword()
return password
end

function getMySQLDBName()
return db
end

function getMySQLHost()
return host
end

function getMySQLPort()
return port
end


[ Dodano: 2016-04-17, 20:15 ]
@ Marcin

Cytat:

-- connection settings
-- global things.
local MySQLConnection = nill
local resultPool = { }
local sqllog = false
local countqueries = 0

-- connectToDatabase - Internal function, to spawn a DB connection
function connectToDatabase(res)
MySQLConnection =mysql_connect(get("mysql.mysql-ols1.ServerProject.pl"), get("mysql.db_16371"), get("mysql.xxxx"), get("mysql.db_16371"), 3306)

if (not MySQLConnection) then
if (res == getThisResource()) then
cancelEvent(true, "Cannot connect to the database.")
end
return nil
end

return nil
end
addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), connectToDatabase, false)

-- destroyDatabaseConnection - Internal function, kill the connection if theres one.
function destroyDatabaseConnection()
if (not MySQLConnection) then
return nil
end
mysql_close(MySQLConnection)
return nil
end
addEventHandler("onResourceStop", getResourceRootElement(getThisResource()), destroyDatabaseConnection, false)

-- do something usefull here
function logSQLError(str)
local message = str or 'N/A'
outputDebugString("MYSQL ERROR "..mysql_errno(MySQLConnection) .. ": " .. mysql_error(MySQLConnection))
--exports['logs']:logMessage("MYSQL ERROR :O! [QUERY] " .. message .. " [ERROR] " .. mysql_errno(MySQLConnection) .. ": " .. mysql_error(MySQLConnection), 24)
end

function getFreeResultPoolID()
local size = #resultPool
if (size == 0) then
return 1
end
for index, query in ipairs(resultPool) do
if (query == nil) then
return index
end
end
return (size + 1)
end

------------ EXPORTED FUNCTIONS ---------------

function ping()
if (not MySQLConnection) then
return false
end

if (mysql_ping(MySQLConnection) == false) then
-- FUU, NO MOAR CONNECTION
destroyDatabaseConnection()
connectToDatabase(nil)
if (not MySQLConnection) then
return false
end
if (mysql_ping(MySQLConnection) == false) then
logSQLError()
return false
end

return true
end

return true
end


function escape_string(str)
if (ping()) then
return mysql_escape_string(MySQLConnection, str)
end
return false
end

function query(str)
if sqllog then
exports['logs']:logMessage(str, 24)
end
countqueries = countqueries + 1

if (ping()) then
local result = mysql_query(MySQLConnection, str)
if (not result) then
logSQLError(str)
return false
end

local resultid = getFreeResultPoolID()
resultPool[resultid] = result
return resultid
end
return false
end

function unbuffered_query(str)
if sqllog then
exports['logs']:logMessage(str, 24)
end
countqueries = countqueries + 1

if (ping()) then
local result = mysql_unbuffered_query(MySQLConnection, str)
if (not result) then
logSQLError(str)
return false
end

local resultid = getFreeResultPoolID()
resultPool[resultid] = result
return resultid
end
return false
end

function query_free(str)
local queryresult = query(str)
if not (queryresult == false) then
free_result(queryresult)
return true
end
return false
end

function rows_assoc(resultid)
if (not resultPool[resultid]) then
return false
end
return mysql_rows_assoc(resultPool[resultid])
end

function fetch_assoc(resultid)
if (not resultPool[resultid]) then
return false
end
return mysql_fetch_assoc(resultPool[resultid])
end

function free_result(resultid)
if (not resultPool[resultid]) then
return false
end
mysql_free_result(resultPool[resultid])
table.remove(resultPool, resultid)
return nil
end

-- incase a nub wants to use it, FINE
function result(resultid, row_offset, field_offset)
if (not resultPool[resultid]) then
return false
end
return mysql_result(resultPool[resultid], row_offset, field_offset)
end

function num_rows(resultid)
if (not resultPool[resultid]) then
return false
end
return mysql_num_rows(resultPool[resultid])

end

function insert_id()
return mysql_insert_id(MySQLConnection) or false
end

function query_fetch_assoc(str)
local queryresult = query(str)
if not (queryresult == false) then
local result = fetch_assoc(queryresult)
free_result(queryresult)
return result
end
return false
end

function query_rows_assoc(str)
local queryresult = query(str)
if not (queryresult == false) then
local result = rows_assoc(queryresult)
free_result(queryresult)
return result
end
return false
end

function query_insert_free(str)
local queryresult = query(str)
if not (queryresult == false) then
local result = insert_id()
free_result(queryresult)
return result
end
return false
end

function escape_string(str)
return mysql_escape_string(MySQLConnection, str)
end

function debugMode()
if (sqllog) then
sqllog = false
else
sqllog = true
end
return sqllog
end

function returnQueryStats()
return countqueries
-- maybe later more
end


Cytat:

username = "db_16371"
password = "xxxxx"
db = "db_16371"
host = "mysql-ols1.ServerProject.pl"
port = 3306

function getMySQLUsername()
return username
end

function getMySQLPassword()
return password
end

function getMySQLDBName()
return db
end

function getMySQLHost()
return host
end

function getMySQLPort()
return port
end


Podpis
<[email protected]>
warsaw-life.pl
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-04-17, 20:25


marcin778

Krytyk serwerów MTA






Wiek: 24
Na forum: 4149 dni
Posty: 2268
Nick w MP: Marcineg

Piwa: 4662

Respekt: 1436,8
Respekt: 1436,8

MySQLConnection =mysql_connect(get("mysql.mysql-ols1.ServerProject.pl"), get("mysql.db_16371"), get("mysql.xxxx"), 
funkcje masz, to poka? mete.

Podpis
Moje prace: https://www.youtube.com/c...MuaWGHPp1mhlGnw

-- obecnie
-- obecnie
-- dawniej
-- dawniej
-- dawniej
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-04-17, 20:36


Demic

Lua&Mapping






Wiek: 29
Na forum: 4247 dni
Posty: 63
Nick w MP: Demic

Piwa: 620

Respekt: 70

Cytat:

<meta>
<info author="El_" type="script" description="MySQL"/>

<script src="s_mysql.lua" type="server"/>

<export function="getMySQLUsername" type="server"/>
<export function="getMySQLPassword" type="server"/>
<export function="getMySQLDBName" type="server"/>
<export function="getMySQLHost" type="server"/>
<export function="getMySQLPort" type="server"/>

<!-- above is legacy -->

<script src="connection.lua" type="server" />
<export function="ping" type="server" http="false" />
<export function="escape_string" type="server" http="false" />
<export function="query" type="server" http="false" />
<export function="unbuffered_query" type="server" http="false" />
<export function="query_free" type="server" http="false" />
<export function="fetch_assoc" type="server" http="false" />
<export function="rows_assoc" type="server" http="false" />
<export function="free_result" type="server" http="false" />
<export function="result" type="server" http="false" />
<export function="num_rows" type="server" http="false" />
<export function="query_fetch_assoc"type="server" http="false" />
<export function="query_rows_assoc" type="server" http="false" />
<export function="insert_id" type="server" http="false" />
<export function="query_rows_assoc" type="server" http="false" />
<export function="query_insert_free"type="server" http="false" />
<export function="escape_string" type="server" http="false" />
<export function="debugMode" type="server" http="false" />
<export function="returnQueryStats" type="server" http="false" />
</meta>


Podpis
<[email protected]>
warsaw-life.pl
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-04-18, 08:08


Loop

Inspektor






Wiek: 27
Na forum: 4289 dni
Posty: 311
Nick w MP: Inspektor

Piwa: 201

Respekt: 130
Respekt: 130

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-04-18, 11:26


MeeShuffle

Programista/Grafik






Wiek: 32
Na forum: 4394 dni
Posty: 2758
Nick w MP: Shuffle

Piwa: 8575

Respekt: 535,3
Respekt: 535,3

Po co u?ywacie mysql_connect i bawi? si? z modu?ami?
Polecam dbConnect, wykorzystuje modu?y wgrane w platform?.

Podpis

https://shufflecode.pl
Static Codes and Graphics - Join our discord!
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-04-18, 11:45


Demic

Lua&Mapping






Wiek: 29
Na forum: 4247 dni
Posty: 63
Nick w MP: Demic

Piwa: 620

Respekt: 70

Shuffle jak db napisa??

Podpis
<[email protected]>
warsaw-life.pl
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-04-18, 11:48


Emm

***** ***






Wiek: 32
Na forum: 3880 dni
Posty: 3191
Nick w MP: Emm

Piwa: 6162

Respekt: 1580
Respekt: 1580Respekt: 1580


   Administrator: Admin ma zawsze rację | REGULAMIN FORUM | REKLAMA/VIP | .

Więcej informacji znajdziesz w Wikipedii MTA:

dbConnect


Więcej informacji znajdziesz w Wikipedii MTA:

dbQuery


Więcej informacji znajdziesz w Wikipedii MTA:

dbExec


Reszt? znajdziesz tam ni?ej

Podpis

Użytkownik: 20.10.2015r
GTAO Member: 06.03.2016r
Support-Team: 20.01.2016r
Moderator: 30.03.2016r
Mod-Team: 08.10.2016r
Vice Admin: 04.05.2018r
Administrator: 03.05.2022r


! Koniecznie zapoznaj się z regulaminem forum.
Pamiętaj, aby zawsze go przestrzegać, nie mniej ważne są również regulaminy działów, w których się wypowiadasz!
Zamiast zakładać temat po kilka razy, bo jest usuwany przez Administrację, przejrzyj regulamin i napisz poprawnie temat!
Sprawy z administracją możesz załatwiać anonimowo w tym dziale.
Najważniejsze informacje od Administracji możesz przeczytać tutaj oraz tutaj.
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-04-18, 11:58


Demic

Lua&Mapping






Wiek: 29
Na forum: 4247 dni
Posty: 63
Nick w MP: Demic

Piwa: 620

Respekt: 70

O to chodzi ?e tego zbytnio nie rozumiem :/

Podpis
<[email protected]>
warsaw-life.pl
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-04-18, 12:31


Emm

***** ***






Wiek: 32
Na forum: 3880 dni
Posty: 3191
Nick w MP: Emm

Piwa: 6162

Respekt: 1580
Respekt: 1580Respekt: 1580


   Administrator: Admin ma zawsze rację | REGULAMIN FORUM | REKLAMA/VIP | .
Tutaj masz ?adny poradnik: http://gtao.pl/tut-poradn...te-vt102403.htm

Podpis

Użytkownik: 20.10.2015r
GTAO Member: 06.03.2016r
Support-Team: 20.01.2016r
Moderator: 30.03.2016r
Mod-Team: 08.10.2016r
Vice Admin: 04.05.2018r
Administrator: 03.05.2022r


! Koniecznie zapoznaj się z regulaminem forum.
Pamiętaj, aby zawsze go przestrzegać, nie mniej ważne są również regulaminy działów, w których się wypowiadasz!
Zamiast zakładać temat po kilka razy, bo jest usuwany przez Administrację, przejrzyj regulamin i napisz poprawnie temat!
Sprawy z administracją możesz załatwiać anonimowo w tym dziale.
Najważniejsze informacje od Administracji możesz przeczytać tutaj oraz tutaj.
Postaw piwo autorowi tego posta
 

 
Tagi: dziwny :: komunikat
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » Dziwny komunikat ? Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Dodaj temat do Ulubionych
Wersja do druku