Modules/MTA-MySQL/mysql null

From Multi Theft Auto: Wiki
Revision as of 18:04, 14 January 2008 by Ryden (talk | contribs)
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 a MySQL null type. MySQL NULL and lua nil are different concepts, and a table row can contain NULL values. In this case, you must check the value comparing it to mysql_null.

Syntax

MySQLNullValue mysql_null ( )

Returns

A MySQL NULL type.

Example

Example 1: This example checks if the name of an account is null.

local result = mysql_query(handler, "SELECT name FROM account WHERE id='1' LIMIT 1") -- Execute the query
if (mysql_result(result, 1, 1) == mysql_null()) then
  outputDebugString("The name of the account #1 is null")
end
mysql_free_result(result) -- Free the result

See also