Scripting/Squirrel/Functions/mysql error: Difference between revisions

From Vice City Multiplayer
Jump to navigation Jump to search
Caution icon
This wiki is using an old backup from 2020
Some information may be old/missing
(Created page with "Returns the last error string of a MySQL connection. == Syntax == <pre>mysql_error( MySQLConnection handler )</pre> == Arguments == * ''MySQLConnection'' '''handler''' - A v...")
 
No edit summary
 
(2 intermediate revisions by 2 users not shown)
Line 20: Line 20:
}</pre>
}</pre>


By KAKAN
== Related Functions ==
{{Scripting/Squirrel/Functions/MySQL Functions}}
[[Category:Scripting/Squirrel/Functions/Mysql_Functions]]

Latest revision as of 18:28, 30 January 2017

Returns the last error string of a MySQL connection.

Syntax

mysql_error( MySQLConnection handler )

Arguments

  • MySQLConnection handler - A valid MySQL link/handler

Return value

The last error string. If no errors are there, then it will return an empty string.

Example

function onScriptLoad(){
   local handler = mysql_connect("localhost","root","password","database");
   local q mysql_query(handler,"SELECT FROM table");
   if( mysql_error( handler ) != "" ) //We have a error.
     print( mysql_error( handler ) ); //So printing the error
   else //No errors, let's free the query.
     mysql_free_result( q );
}

Related Functions