【发布时间】:2018-07-01 11:44:53
【问题描述】:
控制台错误;
117: call: failed to call 'mysql:select' [string "?"]
117: bad argument #1 to 'ipairs' <table expected, got boolean>
函数;
function openAdvertisements( player, command )
local advertisements = { } --These will hold our advertisements to send to the client and populate our advertisement tables.
if not player then player = source end
--Fetch all of the advertisements from the database
for _, ad in ipairs( exports.mysql:select('advertisements') ) do
if tonumber( ad.expiry ) >= tonumber( getRealTime().timestamp ) then --Check if the advertisement has expired, delete it if so.
ad.author = exports.mysql:select_one( "characters", { id = ad.created_by } ).charactername
table.insert( advertisements, ad )
else
deleteAdvertisement( ad.id )
end
end
triggerClientEvent( player, resourceName .. ":display_all", root, advertisements, exports.integration:isPlayerAdmin( player ) ) --Send the advertisements to the client to create the GUI.
end
第 117 行; 对于 _,ipairs 中的广告(exports.mysql:select('advertisements'))做 离开Cs(cid)
【问题讨论】:
-
我通过将
exports.mysql:select('advertisements')更改为mysql:query("SELECT * FROM 'advertisements' WHERE 1")解决了第二个问题,第一个控制台错误已更改为117: bad argument #1 to 'ipairs' <table expected, got number>