Ryder! Posted June 15, 2008 Share Posted June 15, 2008 hi, here is the code: function inicio (res) result = mysql_query(link, "SELECT * FROM torneo_clanes") --get a list of team names while result do row = mysql_fetch_assoc(result) if (not row) then break end outputDebugString(row["clan"]) -- this debug string work great, it shows the list of team names from the mysql result asde = createTeam( row["clan"] ) -- the problem comes here, it return always [b]false[/b] if asde == true then outputDebugString("truecreate") else outputDebugString("falsecreate") end end end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), inicio) What i get from debugstrings: [00:06:59] Starting torneo [00:07:00] INFO: loslojis //these are the team names from the mysql result [00:07:00] INFO: falsecreate [00:07:00] INFO: nubis [00:07:00] INFO: falsecreate [00:07:00] INFO: asdsad [00:07:00] INFO: falsecreate [00:07:00] INFO: jojoy [00:07:00] INFO: falsecreate [00:07:00] INFO: DanieloX [00:07:00] INFO: falsecreate thanks Link to comment
Morelli Posted June 15, 2008 Share Posted June 15, 2008 function inicio (res) local result = mysql_query(link, "SELECT * FROM torneo_clanes") --get a list of team names if ( result ) then for result,row in mysql_rows(result) do local clanname = row["clan"] createTeam( clanname ) end else outputDebugString("mysql_query failed: (" .. mysql_errno(mysqlconnecttoserver) .. ") " .. mysql_error(mysqlconnecttoserver)) end mysql_free_result(result) end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), inicio) Should work in theory. Link to comment
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