SA-MP Forums Archive
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=607007)



MySQL help!! - Fantje - 13.05.2016

Heey guys,

I get these errors:

PHP код:
Log("11:15:33","mysql_connect",1,"empty connection data specified",0);
Log("11:15:33",""mysql_stat"",1,"invalid connection handle (id: 0)",0);
Log("11:15:39",""mysql_format"",1,"invalid connection handle (id: 0)",0);
Log("11:15:39",""mysql_query"",1,"invalid connection handle (id: 0)",0);
Log("11:15:39","cache_get_row_count",2,"no active cache",0);
Log("11:15:39",""mysql_format"",1,"invalid connection handle (id: 0)",0);
Log("11:15:39",""mysql_query"",1,"invalid connection handle (id: 0)",0);
Log("11:15:39","cache_get_row_count",2,"no active cache",0);
Log("11:15:39",""mysql_format"",1,"invalid connection handle (id: 0)",0);
Log("11:15:39",""mysql_query"",1,"invalid connection handle (id: 0)",0);
Log("11:15:39","cache_get_row_count",2,"no active cache",0); 
here my codes:

PHP код:
mysql_log(LOG_ERROR LOG_WARNINGLOG_TYPE_HTML);
    if(
fexist("LOCALHOST")) 
    {
        
koneksi        =    mysql_connect(HOSTUSERDBNAMEPASSWORD);
        
// forum        =    mysql_connect(HOST, USER, FORUMDB, PASSWORD);
    
}
    else
    {
        
koneksi        =    mysql_connect(HOST2USER2DBNAME2PASSWORD2);
        
// forum        =    mysql_connect(HOST2, USER2, FORUMDB, PASSWORD2);
    
}
    
mysql_stat(sqlStatkoneksi);
    
printf("Mysql Status : \n%s"sqlStat); 
Please help, I am sure that I have set the good details for the connection ( into an include but yes it should work ).


Re: MySQL help!! - ExTaZZ69 - 13.05.2016

"invalid connection handle (id: 0)" - Means that koneksi is not an valid handle id. Add some prints in your if - else code to see if this line is executed correctly:
pawn Код:
koneksi        =    mysql_connect(HOST, USER, DBNAME, PASSWORD);



Re: MySQL help!! - Vince - 13.05.2016

Do you know what fexist does? I think you want to do this:
PHP код:
#if defined LOCALHOST
        
koneksi        =    mysql_connect(HOSTUSERDBNAMEPASSWORD);
#else
        
koneksi        =    mysql_connect(HOST2USER2DBNAME2PASSWORD2); 
#endif