Modules/MTA-MySQL/mysql field name

From Multi Theft Auto: Wiki
Revision as of 19:28, 14 January 2008 by Ryden (talk | contribs) (New page: __NOTOC__ {{ModuleFunction|MTA-MySQL}} Returns the name of a given field in the last executed query. The offset of the field must be an integer between '''1''' and '''[[Modules/MTA-MySQL/m...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


Package-x-generic.png This function is provided by the external module MTA-MySQL. You must install this module to use this function.

Returns the name of a given field in the last executed query. The offset of the field must be an integer between 1 and Modules/MTA-MySQL/mysql_num_rows/mysql_num_fields()

Syntax

int mysql_field_name ( MySQLResult result, int offset )

Required arguments

  • result: A valid MySQL result
  • offset: A valid offset

Returns

The given field name.

Example

Example 1:

local result = mysql_query(handler, "SELECT name FROM account WHERE id='1' LIMIT 1") -- Execute the query
if (result) then
  local str = mysql_field_name(result, 1)
  outputDebugString(str) -- Will print 'name'
  mysql_free_result(result) -- Free the result
end

See also