16.04.2011, 21:28
Hi guys.
I'm using the G-sTyLeZzZ's MySQL plugin now, but i receive some errors.
This is a piece my code:
What's wrong with:
And...
And...
And...
And...
How to fix them?
I'm using the G-sTyLeZzZ's MySQL plugin now, but i receive some errors.
This is a piece my code:
Код:
#include <a_samp> #include <dudb> #include <mysql> #define SQL_HOST "hostname" #define SQL_USER "username" #define SQL_PASS "password" #define SQL_DB "database" #define TEAM_ADMIN 1 static gTeam[MAX_PLAYERS]; new logged[MAX_PLAYERS]; new adminlevel[MAX_PLAYERS]; new money[MAX_PLAYERS]; new vkey[MAX_PLAYERS]; new pName[MAX_PLAYER_NAME]; forward ConnectMySQL(); public ConnectMySQL() { mysql_connect(SQL_HOST, SQL_USER, SQL_DB, SQL_PASS); if(mysql_ping() == 1) { mysql_debug(1); printf("[MYSQL]: Connection to `%s` succesful!", SQL_DB); } else { printf("[MYSQL]: [ERROR]: Connection to `%s` failed!", SQL_DB); } return 1; }
Код:
mysql_debug(1); //Errorcode: //C:\SAMP Server\Server\filterscripts\Admin-MySQL.pwn(432) : error 017: undefined symbol "mysql_debug"
Код:
format(loginstring, sizeof(loginstring), "Succesfully logged in with: %s, Money: %d", mysql_store_result(username), money[playerid]); //I don't know how to use the mysql_store_result function... //Errorcode: C:\SAMP Server\Server\filterscripts\Admin-MySQL.pwn(337) : error 017: undefined symbol "username"
Код:
mysql_query("SELECT `password` FROM `users` WHERE `username` = '%s'", pName); //Errorcode: C:\SAMP Server\Server\filterscripts\Admin-MySQL.pwn(335) : error 035: argument type mismatch (argument 2)
Код:
money[playerid] = mysql_store_result(money) //Again, i don't know how to use the mysql_store_result function... //Errorcode: C:\SAMP Server\Server\filterscripts\Admin-MySQL.pwn(334) : error 035: argument type mismatch (argument 1)
Код:
mysql_query("INSERT INTO `users` (`username`, `password`) VALUES ('%s', '%s')", pName, inputtext); //Errorcode: C:\SAMP Server\Server\filterscripts\Admin-MySQL.pwn(276) : error 035: argument type mismatch (argument 2)