[Tutorial] MySQL for beginners!
#7

Quote:
Originally Posted by Faraday
View Post
The first function is to connect MySQL and is a function we will put in OnGameModeInit.
pawn Code:
forward ConnectMySQL();
public ConnectMySQL()
{
    if(mysql_connect(SQL_HOST,SQL_USER,SQL_DB,SQL_PASS))
    {
        mysql_debug(1);
        printf("[MYSQL]: Connection to `%s` succesful!",SQL_DB);
    }
    else // This will not be called, even if the MySQL server is away.
    {
      printf("[MYSQL]: [ERROR]: Connection to `%s` failed!",SQL_DB);
    }
    return 1;
}
mysql_connect doesn't return anything if the MySQL server is away, use mysql_ping to check the connection.
________
Essential vaaapp vaporizer
Reply


Messages In This Thread
MySQL for beginners! - by Faraday - 08.09.2010, 20:46
Re: MySQL for beginners! - by Calgon - 08.09.2010, 21:10
Re: MySQL for beginners! - by DiddyBop - 08.09.2010, 21:13
Re: MySQL for beginners! - by [L3th4l] - 08.09.2010, 23:07
Re: MySQL for beginners! - by playbox12 - 09.09.2010, 19:24
Re: MySQL for beginners! - by Faraday - 09.09.2010, 21:01
MySQL for beginners! - by [NoV]LaZ - 09.09.2010, 21:10
Re: MySQL for beginners! - by Mr.Jvxmc - 04.01.2011, 11:23
Re: MySQL for beginners! - by bartje01 - 11.06.2011, 23:56
Re: MySQL for beginners! - by Lorenc_ - 12.06.2011, 00:05

Forum Jump:


Users browsing this thread: 2 Guest(s)