Modules/MTA-MySQL/mysql rows: Difference between revisions
Jump to navigation
Jump to search
(New page: __NOTOC__ Creates an iterator for the result rows. When this function is called, the row cursor is set to the first result row. ==Syntax== <syntaxhighlight lang="lua"> iterator mysql_rows ( MySQLResult ...) |
mNo edit summary |
||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
<pageclass class="#AA7592" subcaption="MTA-MySQL Module"></pageclass> | |||
__NOTOC__ | __NOTOC__ | ||
{{ModuleFunction|MTA-MySQL}} | |||
Creates an iterator for the result rows. When this function is called, the row cursor is set to the first result row. | Creates an iterator for the result rows. When this function is called, the row cursor is set to the first result row. | ||
Latest revision as of 18:04, 5 January 2011
This function is provided by the external module MTA-MySQL. You must install this module to use this function. | |
Creates an iterator for the result rows. When this function is called, the row cursor is set to the first result row.
Syntax
iterator mysql_rows ( MySQLResult result )
Required arguments
- result: A valid MySQL result
Returns
An iterator function to iterate all the result rows.
Example
Example 1: This example prints all the accounts names
local result = mysql_query(handler, "SELECT name FROM account") -- Execute the query if (result) then for result,row in mysql_rows(result) do outputDebugString(row[1]) end mysql_free_result(result) -- Free the result end