MYSQL Connection - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: MYSQL Connection (
/showthread.php?tid=515796)
MYSQL Connection -
ChuckyBabe - 28.05.2014
How do i setup this MYSQL because i can't connect/login to my server.
pawn Код:
// ( MySQL - Connection )
#if USE_LOCALHOST == true
#define LOCAL_HOST "localhost"
#define LOCAL_USER "root"
#define LOCAL_PASS ""
#define LOCAL_DB "asdas"
#else
#define SERVER_HOST "localhost"
#define SERVER_USER "root"
#define SERVER_PASS ""
#define SERVER_DB "asdas"
#endif
PLEASE HELP ME!
Re: MYSQL Connection -
nmader - 28.05.2014
Have you used mysql_connect anywhere?
Re: MYSQL Connection -
ChuckyBabe - 28.05.2014
Yes here
pawn Код:
//============================== Connecting MySQL ========================//
#if USE_LOCALHOST == false
mysql_connect( SERVER_HOST, SERVER_USER, SERVER_DB, SERVER_PASS );
print( ":: MySQL Conecting :: To '"SERVER_HOST"' as '"SERVER_USER"' to database '"SERVER_DB"'." );
#else
mysql_connect( LOCAL_HOST, LOCAL_USER, LOCAL_DB, LOCAL_PASS );
print( ":: MySQL Conecting :: To '"LOCAL_HOST"' as '"LOCAL_USER"' to database '"LOCAL_DB"'." );
#endif
if ( mysql_ping ( ) != 1 )
{
#if USE_LOCALHOST == false
print(":: MySQL :: Connecting to '"SERVER_HOST"' failed.");
#else
print(":: MySQL :: Connecting to '"LOCAL_HOST"' failed.");
#endif
//SendRconCommand( "exit" );
//return false;
}
#if USE_LOCALHOST == false
print(":: MySQL :: Connection to '"SERVER_HOST"' established.");
print(":: MySQL :: Database '"SERVER_DB"' selected.");
#else
print(":: MySQL :: Connection to '"LOCAL_HOST"' established.");
print(":: MySQL :: Database '"LOCAL_DB"' selected.");
#endif
Re: MYSQL Connection -
nmader - 28.05.2014
And this is on OnGameModeInit, yes?
Re: MYSQL Connection -
ChuckyBabe - 28.05.2014
Yea please help
Re: MYSQL Connection -
ChuckyBabe - 28.05.2014
BUMP!!
Re: MYSQL Connection -
Mark_Weston - 29.05.2014
server log please?
Re: MYSQL Connection -
ChuckyBabe - 29.05.2014
Server log ? i just want to ask how do i connect my sql ?
Re: MYSQL Connection -
iRaiDeN - 29.05.2014
Quote:
Originally Posted by ChuckyBabe
Server log ? i just want to ask how do i connect my sql ?
|
PHP код:
public OnGameModeInit()
{
#if USE_LOCALHOST == 1
dbHandle = mysql_connect(LOCAL_HOST,LOCAL_USER,LOCAL_DB,LOCAL_PASS);
#else
dbHandle = mysql_connect(SERVER_HOST,SERVER_USER,SERVER_DB,SERVER_PASS);
#endif
}
Re: MYSQL Connection -
biker122 - 29.05.2014
Quite sure this is an SEv2 gamemode. This is why some people fail while they don't know how it works..