MySQL help
#1

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
Reply
#2

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_HOSTMYSQL_USERMYSQL_PASSMYSQL_DB);
    
#else
     
g_SQL mysql_connect(MYSQL_HOSTMYSQL_USERMYSQL_PASSMYSQL_DB);
     
#endif

and check wiki for more information about MySQL
Reply
#3

thanks alot
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)