MySQL help - 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 help (
/showthread.php?tid=655113)
MySQL help -
CaptainBoi - 13.06.2018
i am just new in mysql but i got it better alot in making systems etc etc
but i want to know that how can i make it based for 2 hosts like
if defined server_host
#define MYSQL_HOST ""
#define MYSQL_USER ""
#define MYSQL_PASS ""
#define MYSQL_DB ""
load this information but if Localhost defined then use the other one
like i tried by this
PHP код:
#define LOCAL_HOST
#define SERVER_HOST
#if defined SERVER_HOST
/* Mysql Entities */
#define MYSQL_HOST ""
#define MYSQL_USER ""
#define MYSQL_PASS ""
#define MYSQL_DB ""
/* Mysql Entities */
#endif
#if defined LOCAL_HOST
/* Local Host */
#define MYSQL_HOST ""
#define MYSQL_USER ""
#define MYSQL_PASS ""
#define MYSQL_DB ""
/* Local Host */
#endif
help please i want it so i dont have to define that again and again and it work in both
localhost and server host
Re: MySQL help -
Slawi - 13.06.2018
PHP код:
//#define LOCAL_HOST
#define SERVER_HOST
#if defined SERVER_HOST
/* Mysql Entities */
#define MYSQL_HOST ""
#define MYSQL_USER ""
#define MYSQL_PASS ""
#define MYSQL_DB ""
/* Mysql Entities */
#else
/* Local Host */
#define MYSQL_HOST ""
#define MYSQL_USER ""
#define MYSQL_PASS ""
#define MYSQL_DB ""
/* Local Host */
#endif
public OnGameModeInit()
{
#if defined SERVER_HOST
g_SQL = mysql_connect(MYSQL_HOST, MYSQL_USER, MYSQL_PASS, MYSQL_DB);
#else
g_SQL = mysql_connect(MYSQL_HOST, MYSQL_USER, MYSQL_PASS, MYSQL_DB);
#endif
}
and check wiki for more information about MySQL
Re: MySQL help -
CaptainBoi - 13.06.2018
thanks alot