Hello,
I have been trying to create multi requests in the same time. I made this script but I would like if it’s possible to make it with only on MySQL.Async.fetchAll
RegisterServerEvent('Entreprise:MoreInfo')
AddEventHandler('Entreprise:MoreInfo', function(entdetail)
local ent = entdetail.id
print(ent)
local source = source
MySQL.Async.fetchAll("SELECT * FROM `facture_list` LEFT JOIN users ON facture_list.vendeur = users.identifier WHERE entreprise = @ent",{['@ent']=ent}, function(facture_list)
local facture_list = facture_list
MySQL.Async.fetchAll('SELECT * FROM save_ca WHERE entreprise = @ent ORDER BY semaine ASC LIMIT 5',{['@ent']=ent},function(save_ca)
local save_ca = save_ca
MySQL.Async.fetchAll('SELECT * FROM save_finance WHERE entreprise = @ent ORDER BY semaine ASC LIMIT 5 ',{['@ent']=ent},function(save_fin)
local save_fin = save_fin
TriggerClientEvent('Gestion:Open',source,facture_list,save_ca,save_fin)
end)
end)
end)
end)
I tried that but it doesn’t work :
MySQL.Async.fetchAll("SELECT * FROM `facture_list` LEFT JOIN users ON facture_list.vendeur = users.identifier WHERE entreprise = @ent;
SELECT * FROM save_ca WHERE entreprise = @ent ORDER BY semaine ASC LIMIT 5;
SELECT * FROM save_finance WHERE entreprise = @ent ORDER BY semaine ASC LIMIT 5"
,{['@ent']=ent}, function(facture_list,save_ca,save_fin)
TriggerClientEvent('Gestion:Open',source,facture_list,save_ca,save_fin)
end)