SQL Not Compiling.
#1

So i have this error :

Код:
Balabablala - (5967 -- 5970) : error 001: expected token: ",", but found ";"
To this code :

Код:
forward OnPlayerSave(playerid);
public OnPlayerSave(playerid)
{

	new query[500];
        mysql_format(MySQLCon, query, sizeof(query), "UPDATE `players` SET `Admin`=%d, `Vip`=%d WHERE `ID`=%d AND `user`='%e'",
        PlayerInfo[playerid][pAdmin],
        PlayerInfo[playerid][pVIP],
        mysql_tquery(MySQLCon, query, "", "");
        print(query);
	return 1;
}
Whats the problem here ?
Reply
#2

Well, 1;

- You used both 'Admin=%d', 'Vip=%d', 'ID=%d' and 'user=%d' but I only see, in the next parameters:
PlayerInfo[playerid][pAdmin]
PlayerInfo[playerid][pVip]
mysql_tquery(blabla)

Now,
1- I don't think the mysql_tquery() should be in there as a parameters . That might occur this error aswell
2- Don't forget the two other variables
Reply
#3

Count the number of open round brackets and the number of closing round brackets. Then realize those numbers don't match and that you've made a mistake. Look carefully.
Reply
#4

I saw it indeed aswell (not gonna tell where it is so that scout322 can find this out hisself - he/she'd learn better from it), but when I wanted to typ it I forgot it somehow haha
Reply
#5

So what shoud i do with ID and User parameters ?? i have no idea what im doing. just started to lern how MYSQL works in gta
Reply
#6

Well, those parameters have nothing to do with the MYSQL. If I would do the same with just using format or printf (for example) I'd get the same error. I just said that you included a function in the parameter -which is wrong- and that your parameters do not match the format specifiers (though that doesn't show warnings or errors in the compiler)
Reply
#7

Here you go...

pawn Код:
//Your Function

forward OnPlayerSave(playerid);
public OnPlayerSave(playerid)
{

    new query[256];
    mysql_format(MySQLCon, query, sizeof(query), "UPDATE `players` SET `Admin`=%d, `Vip`=%d WHERE `ID`=%d AND `user`='%e'", PlayerInfo[playerid][pAdmin], PlayerInfo[playerid][pVIP],PlayerInfo[playerid][pIP],GNAME(playerid));
    mysql_tquery(MySQLCon, query, "", "");
    print(query);
    return 1;
}

//Add this below your code. It is the GNAME function <to get player name and return it>

stock GNAME(playerid)
{
    new pName[24];
    GetPlayerName(playerid,pName,24);
    return pName;
}
Next time, when you encounter a problem try to really think on the solution, instead of posting it here. It will allow you to improve as a scripter instead of just letting people do things for you.
Reply
#8

So what would the code look like if i need to store my pAdmin and pVIP values ? Sorry for theses stupid qustions.. Im just tryng to understand smth. The wiki doesnt help anything for me....
Reply
#9

Scout look at my other post I made recently.

It is all there.
Reply
#10

Thank you ! Rep +
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)