Scripting/Squirrel/Functions/mysql connect

From Vice City Multiplayer
Revision as of 10:42, 28 September 2015 by CRAST (talk | contribs) (Created page with "This function will connect to a MySQL database on the server. == Syntax == <pre>mysql_connect( host, dbuser, dbpassword, dbname);</pre> == Arguments == * ''string'' '''hos...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Caution icon
This wiki is using an old backup from 2020
Some information may be old/missing

This function will connect to a MySQL database on the server.

Syntax

mysql_connect( host, dbuser, dbpassword, dbname);

Arguments

  • string host - The host of the MySQL database (Most cases "localhost")
  • string dbuser - The MySQL user name.
  • string dbpassword - The MySQL user password.
  • string dbname - The MySQL database name.

Example

function onScriptLoad()
{
 db <- mysql_connect( "localhost", "vcmp", "test123", "vcmpdb");
}


Notes

You can also remotely connect to a MySQL database, replace "localhost" with the remote host IP and make sure the host accepts remote connections.