Converting?
#1

ok, so i just recently changed hosts, and ive always used mysql r5, however, it just wont run on my new host, while mysql r7 does, so what im wondering, is does anyone know of a tutorial on converting from mysqlr5 (mysql_query) to the new function, (mysql_fucntion_query)?, or mabey someone could just tell me in this thread?


also, here's my setlevel cmd (ill convert it, then ill learn how from there how to convert everything else)

pawn Код:
CMD:setlevel(playerid,params[])
{
    new Query[128];
    new SetLevel[200];
    format(Query,sizeof(Query),"SELECT * FROM `Users` WHERE `Username` = '%s' AND `Alevel` = '10'",GetName(playerid));
    mysql_query(Query);
    format(SetLevel,sizeof(SetLevel),"INSERT INTO `Users` WHERE `Username` = '%s' AND `Alevel` = '%s'",GetName(playerid),params);
    mysql_query(SetLevel);
    return 1;
}
Reply
#2

Yes, here's a really great tutorial: https://sampforum.blast.hk/showthread.php?tid=337810

MySQL R34 is out and I'd recommend you to use it. Though, R7 is fine as well since it uses threaded queries.
Reply
#3

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
Yes, here's a really great tutorial: https://sampforum.blast.hk/showthread.php?tid=337810

MySQL R34 is out and I'd recommend you to use it. Though, R7 is fine as well since it uses threaded queries.

ive seen that one already, and i dont understand it
Reply
#4

You do not need to call the query in the command itself. Just create a SaveStats function, and then set their level variable to the new variable, and call the SaveStats function itself.

Ex. PInfo[playerid][ALevel] = level; SaveStats(playerid);

Took the liberty of creating a simple SaveStats function using MySQL R7:
Код:
forward SendQuery();
public SendQuery() return 1;

stock SaveStats(playerid)
{
        new query[90];
	format(query,sizeof(query),"UPDATE `Accounts` SET `ALevel` = '%i' WHERE `Username` = '%s'",
	PInfo[playerid][ALevel],
	GetName(playerid));
	mysql_function_query(MySQL, query, false, "SendQuery", "");
	return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)