SA-MP Forums Archive
Trivial MYSQL problem. - 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: Trivial MYSQL problem. (/showthread.php?tid=618082)



Trivial MYSQL problem. - Dayrion - 30.09.2016

Hey. I've a problem with MySQL. I'm starting to learn how to use Mysql and there is no real tutoriel to use it.. so I try to learn by myself. Actually, the problem is i've a warning for this :
PHP код:
#define SQL_HOST "localhost"
#define SQL_USER "root"
#define SQL_PASS ""
#define SQL_DB "gm"
static MySQL;
public 
OnGameModeInit()
{
    
MySQL mysql_connect(SQL_HOSTSQL_USERSQL_DBSQL_PASS); // This line 
Код:
warning 213: tag mismatch
I don't understand why.


Re: Trivial MYSQL problem. - Kaliber - 30.09.2016

It should be:

PHP код:
static DB:MySQL



Re: Trivial MYSQL problem. - Konstantinos - 30.09.2016

R40+ version of the plugin uses MySQL: tag for connection handle: https://sampwiki.blast.hk/wiki/MySQL/R40#mysql_connect

@Kaliber: DB tag is for SQLite.


Re: Trivial MYSQL problem. - Dayrion - 01.10.2016

Thanks for you help.
Also I've an another problem even if I check the wiki, I do the same the thing and I've an error. >.<
PHP код:
    new query[200];
    
mysql_format(MySQLquerysizeof(query), "UPDATE `Users` SET `Kills` = %d"GetPlayerScore(playerid)*2);
    
mysql_query(query); 
Код:
error 035: argument type mismatch (argument 1)
Код:
mysql_query(query[], resultid, extraid, connectionHandle)
What is wrong?


Re: Trivial MYSQL problem. - TheDarkBlade - 01.10.2016

Код:
mysql_format(MySQL, query, sizeof(query), "UPDATE `Users` SET `Kills` = '%d'", GetPlayerScore(playerid)*2);
mysql_query(,MySQL,query);



Re: Trivial MYSQL problem. - Konstantinos - 01.10.2016

Quote:
Originally Posted by Dayrion
Посмотреть сообщение
Also I've an another problem even if I check the wiki, I do the same the thing and I've an error.
Check the wiki on the link I posted, the other two pages that exist are for R5 to R6-2 and R33+

About the last post, the plugin failed to load. Is it Windows or Linux? If it is Windows, do you have libmysqld.dll and log-core.dll into the main directory?


Re: Trivial MYSQL problem. - Dayrion - 01.10.2016

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
Check the wiki on the link I posted, the other two pages that exist are for R5 to R6-2 and R33+

About the last post, the plugin failed to load. Is it Windows or Linux? If it is Windows, do you have libmysqld.dll and log-core.dll into the main directory?
I wasn't on the correct version. I didn't saw it, my bad.

Windows! I have both of these file in the main directory (if you mean before folder plugins, pawno, etc...).


Re: Trivial MYSQL problem. - Dayrion - 03.10.2016

Quote:
Originally Posted by Dayrion
Посмотреть сообщение
I wasn't on the correct version. I didn't saw it, my bad.

Windows! I have both of these file in the main directory (if you mean before folder plugins, pawno, etc...).
BUMP!


Re: Trivial MYSQL problem. - Konstantinos - 03.10.2016

Quote:
Originally Posted by Dayrion
Посмотреть сообщение
Windows! I have both of these file in the main directory (if you mean before folder plugins, pawno, etc...).
Do you get a missing .dll file when starting the server? It requires Microsoft Visual C++ 2015 Redistributable Package (x86 version).


Re: Trivial MYSQL problem. - Dayrion - 13.10.2016

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
Do you get a missing .dll file when starting the server? It requires Microsoft Visual C++ 2015 Redistributable Package (x86 version).
Thanks you.
I can't connect to my database. '-'
PHP код:
#define    MYSQL_HOST        "localhost" 
#define    MYSQL_USER        "root" 
#define    MYSQL_DATABASE    "myserver" 
#define    MYSQL_PASSWORD    "" 
static MySQL:MySQL;
public 
OnGameModeInit() 

    
//mysql_log(LOG_ALL); 
    
MySQL mysql_connect(MYSQL_HOSTMYSQL_USERMYSQL_DATABASEMYSQL_PASSWORD); 
    if(
mysql_errno() != 0
    { 
        
printf("[MySQL] The connection has failed."); 
    } 
    else 
    { 
        
printf("[MySQL] The connection was successful."); 
    }