Need help with some MySQL errors
#1

Hi guys.

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;
}
What's wrong with:
Код:
mysql_debug(1);

//Errorcode:
//C:\SAMP Server\Server\filterscripts\Admin-MySQL.pwn(432) : error 017: undefined symbol "mysql_debug"
And...
Код:
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"
And...
Код:
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)
And...
Код:
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)
And...
Код:
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)
How to fix them?
Reply
#2

I'm pretty sure it's:

#include <a_mysql>
Reply
#3

The MySQL works fine now!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)