can anyone help me mysql problem when i try to fix i cant pfff hope you solve my problem
[/] MTA: San Andreas :: 0/32 players ::157 resources ::151 fps (25)[02:07:13] ERROR:Couldn't find resource pwnage. Check it exists.
[02:07:13] ERROR: Couldn't find resource cinema.Check it exists.[02:07:13]Creatingnew DB table vending_machines
[02:07:13] ERROR:Couldn't find resource changename-system. Check it exists.
[02:07:13] Querying MTA master server... success! (Auto detected IP:154.109.159.
190)
[02:07:13] Authorized serial account protection is enabled for the ACL group(s):
`Admin` See https://mtasa.com/authserial
[02:07:13] WARNING: <owner_email_address> not set
[02:07:13] Server started and is ready to accept connections!
[02:07:13] To stop the server, type 'shutdown' or press Ctrl-C
[02:07:13] Type 'help' for a list of commands.
[02:07:13] Stopping global
[02:07:13] Starting global
[02:07:13] ERROR: mysql\connection.lua:62: attempt to call global 'mysql_ping' (
a nil value)
[02:07:13] ERROR: global\money_globals.lua:26: call: failed to call 'mysql:query
' [string "?"]
[02:07:13] ERROR: mysql\connection.lua:62: attempt to call global 'mysql_ping' (
a nil value)
[02:07:13] ERROR: global\money_globals.lua:37: call: failed to call 'mysql:query
' [string "?"]
[02:07:13] global restarted successfully
thease my sql
--[[
MMR
]]local connection =nillocal connection =nillocalnull=nillocal results ={}local max_results =128-- connection functions
localfunction connect()-- retrieve the settings
local server ="192.168.8.100"local user ="678_basespielers"local password ="basemed"local db ="678_basespielers"local port =get("port")or3306local socket =get("socket")ornil-- connect
connection = mysql_connect ( server, user, password, db, port, socket )if connection thenif user =="root"then
setTimer( outputDebugString,100,1,"Connecting to your MySQL as 'root' is strongly discouraged.",2)endreturntrueelse
outputDebugString ("Connection to MySQL Failed.",1)returnfalseendendlocalfunction disconnect()if connection and mysql_ping( connection )then
mysql_close( connection )endendlocalfunction checkConnection()ifnot connection ornot mysql_ping( connection )thenreturn connect()endreturntrueend
addEventHandler("onResourceStart", resourceRoot,function()ifnot mysql_connect thenif hasObjectPermissionTo( resource,"function.shutdown")then
shutdown("MySQL module missing.")end
cancelEvent(true,"MySQL module missing.")
elseif not hasObjectPermissionTo( resource,"function.mysql_connect")thenif hasObjectPermissionTo( resource,"function.shutdown")then
shutdown("Insufficient ACL rights for mysql resource.")end
cancelEvent(true,"Insufficient ACL rights for mysql resource.")
elseif not connect()thenif connection then
outputDebugString( mysql_error( connection ),1)endif hasObjectPermissionTo( resource,"function.shutdown")then
shutdown("MySQL failed to connect.")end
cancelEvent(true,"MySQL failed to connect.")elsenull= mysql_null()endend)
addEventHandler("onResourceStop", resourceRoot,function()for key, value in pairs( results )do
mysql_free_result( value.r )
outputDebugString("Query not free()'d: ".. value.q,2)end
disconnect()end)--function escape_string( str )if type( str )=="string"thenreturn mysql_escape_string( connection, str )
elseif type( str )=="number"thenreturn tostring( str )endendlocalfunction query( str,...)
checkConnection()if(...)thenlocal t ={...}for k, v in ipairs( t )do
t[ k ]= escape_string( tostring( v ))or""end
str = str:format( unpack( t ))endlocal result = mysql_query( connection, str )if result thenfor num =1, max_results doifnot results[ num ]then
results[ num ]={ r = result, q = str }return num
endend
mysql_free_result( result )returnfalse,"Unable to allocate result in pool"endreturnfalse, mysql_error( connection )endfunction query_free( str,...)if sourceResource == getResourceFromName("runcode")thenreturnfalseend
checkConnection()if(...)thenlocal t ={...}for k, v in ipairs( t )do
t[ k ]= escape_string( tostring( v ))or""end
str = str:format( unpack( t ))endlocal result = mysql_query( connection, str )if result then
mysql_free_result( result )returntrueendreturnfalse, mysql_error( connection )endfunction free_result( result )if results[ result ]then
mysql_free_result( results[ result ].r )
results[ result ]=nilendendfunction query_assoc( str,...)if sourceResource == getResourceFromName("runcode")thenreturnfalseendlocal t ={}local result, error = query( str,...)if result thenfor result, row in mysql_rows_assoc( results[ result ].r )dolocal num =#t + 1
t[ num ]={}for key, value in pairs( row )doif value ~=nullthen
t[ num ][ key ]= tonumber( value )or value
endendend
free_result( result )return t
endreturnfalse, error
endfunction query_assoc_single( str,...)if sourceResource == getResourceFromName("runcode")thenreturnfalseendlocal t ={}local result, error = query( str,...)if result thenlocal row = mysql_fetch_assoc( results[ result ].r )if row thenfor key, value in pairs( row )doif value ~=nullthen
t[ key ]= tonumber( value )or value
endend
free_result( result )return t
end
free_result( result )returnfalseendreturnfalse, error
endfunction query_insertid( str,...)if sourceResource == getResourceFromName("runcode")thenreturnfalseendlocal result, error = query( str,...)if result thenlocal id = mysql_insert_id( connection )
free_result( result )return id
endreturnfalse, error
endfunction query_affected_rows( str,...)if sourceResource == getResourceFromName("runcode")thenreturnfalseendlocal result, error = query( str,...)if result thenlocal rows = mysql_affected_rows( connection )
free_result( result )return rows
endreturnfalse, error
end
next layout
--[[
MMR
]]local allowUpdate =get('auto_update')~=0-- change this setting to 0 to only print the required queries to console but not actually change stuff, removing it or setting it to anything but 0 leaves it enabled
--local query_update =nilif allowUpdate then
query_update = query_free
else
query_update =function( str,...)if(...)thenlocal t ={...}for k, v in ipairs( t )do
t[ k ]= escape_string( tostring( v ))or""end
str = str:format( unpack( t ))end
outputServerLog( str )returntrueendendlocalfunction getColumnString( value )local str ="`".. escape_string( value.name ).."` ".. escape_string( value.type )ifnot value.nullthen
str = str .." NOT NULL"endif value.defaultthenif value.default=='CURRENT_TIMESTAMP'then
str = str .." DEFAULT CURRENT_TIMESTAMP"else
str = str .." DEFAULT '".. escape_string( tostring( value.default)).."'"endendif value.auto_increment then
str = str .." AUTO_INCREMENT"endreturn str
endfunction create_table( name, columns )if sourceResource == getResourceFromName("runcode")thenreturnfalseendifnot query_assoc_single("SHOW TABLES LIKE '%s'", name )then--try to create the missing table
local cols ={}local keys ={}local autoIncrementValue =""for key, value in pairs( columns )doif value.primary_key then
table.insert( keys,"`".. escape_string( value.name ).."`")endif type( value.auto_increment )=="number"then
autoIncrementValue =" AUTO_INCREMENT=".. value.auto_increment
end
table.insert( cols, getColumnString( value ))endif#keys > 0 then
table.insert( cols,"PRIMARY KEY (".. table.concat( keys,", ")..")")endif query_update("CREATE TABLE `%s`(\n ".. table.concat( cols,",\n ").."\n) ENGINE=MyISAM".. autoIncrementValue, name )then
outputDebugString("Created table ".. name,3)returntrue,trueelse
outputDebugString("Unable to create table ".. name,1)returnfalseendelse-- make sure all columns do exist
local result = query_assoc('DESCRIBE '.. name )local fields ={}local primary_keys ={}local has_primary_key =falselocal change_primary_keys =falsefor key, value in pairs( result )do
fields[ value.Field]={ name = value.Field, type = value.Type,null= value.Null=="YES", auto_increment = value.Extra=="auto_increment", primary_key = value.Key=='PRI'ornil,default= value.Default}if value.Key=='PRI'then
has_primary_key =trueendendlocal insertWhere ="FIRST"for key, value in ipairs( columns )doifnot fields[ value.name ]thenif query_update("ALTER TABLE `%s` ADD ".. getColumnString( value ).." ".. insertWhere, name )then
outputDebugString("Created column ".. name ..".".. value.name,3)else
outputDebugString("Unable to create column ".. name ..".".. value.name,1)returnfalseendelse--let's check if everything is alright
local f = fields[ value.name ]
local str = getColumnString( value )
if getColumnString( f ) ~= str then
if query_update( "ALTER TABLE `%s` MODIFY COLUMN " .. str, name ) then
outputDebugString( "Changed field " .. name .. "." .. value.name, 3 )
else
outputDebugString( "Changing field " .. name .. "." .. value.name .. " failed", 1 )
return false
end
end
-- verify our primary keys
if value.primary_key then
table.insert( primary_keys, "`" .. escape_string( value.name ) .."`" )
end
if f.primary_key ~= value.primary_key then
change_primary_keys = true
end
end
insertWhere = "AFTER `" .. escape_string( value.name ) .. "`"
end
-- change the primary key if we have to
if change_primary_keys then
outputDebugString( "Changing primary keys...", 3 )
if has_primary_key then
if #primary_keys == 0 then
if not query_update( "ALTER TABLE `%s` DROP PRIMARY KEY", name ) then
outputDebugString( "Unable to drop primary key", 1 )
return false
end
else
if not query_update( "ALTER TABLE `%s` DROP PRIMARY KEY, ADD PRIMARY KEY(" .. table.concat( primary_keys, ", " ) .. ")", name ) then
outputDebugString( "Unable to change primary key", 1 )
return false
end
end
elseif #primary_keys > 0 then
if not query_update( "ALTER TABLE `%s` ADD PRIMARY KEY(" .. table.concat( primary_keys, ", " ) .. ")", name ) then
outputDebugString( "Unable to add new primary key", 1 )
return false
end
end
end
return true, false
end
end
Question
Yasuoo
can anyone help me mysql problem when i try to fix i cant pfff hope you solve my problem
thease my sql
next layout
Link to comment
1 answer to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now