[MySQL] Updating Player's Ban Information
#1

Alright, first of my problem is, I don't know what's wrong in my command, because as I can see it is right, but for other people might able to see the probably I'm facing, Quick Explanation: when I ban a player it doesn't update the player's Banned Variable, it says 0, it should be 1 on phpMyAdmin

Banning Stock
pawn Код:
stock BanPlayer(playerid)
{
    KickEx(playerid);
    TotalBannedPlayers++;
   
    new Query[128];
    format(Query, sizeof(Query), "UPDATE `bans` SET  `Banned` = 1 WHERE Username = '%s';", PlayerName(playerid));
    mysql_query(Query);
}
Picture


PS: I'm using MySQL R6, since I'm used to it, before you comment use R7, I'll learn and study R7 when I do have extra time
Reply
#2

Execute the query in phpmyadmin to see the error it's causing. I'm not too sure you need a semi-colon (;) on the end of the query though.
Reply
#3

Alright, here's my Debug result Tyler12 It does say Successfully executed. but for some reason it doesn't set the variable to 1 in phpmyadmin

pawn Код:
[18:18:35] >> mysql_query( Connection handle: 1 )

[18:18:35] CMySQLHandler::Query(UPDATE `bans` SET  `Banned` = 1 WHERE Username = 'pds2012';) - Successfully executed.

[18:18:35] >> mysql_real_escape_string( Connection handle: 1 )

[18:18:35] CMySQLHandler::EscapeString(... test ... ,,, \ --[[); - Escaped 24 characters to ... test ... ,,, \\ --[[.

[18:18:35] >> mysql_query( Connection handle: 1 )

[18:18:35] CMySQLHandler::Query(INSERT INTO `bans` (Username, IpAdress, Reason, BannedBy) VALUES ('pds2012', 'pds2012', '... test ... ,,, \\ --[[', 'pds2012')) - Successfully executed.

[18:18:35] >> mysql_query( Connection handle: 1 )
MySQL Structure ( Image )


PS: I also tried removing ; at the last, but no. it still don't work
Reply
#4

pawn Код:
format(Query, sizeof(Query), "UPDATE `bans` SET  `Banned` = 1 WHERE Username = '%s';", /*shouldn't there be something?*/,PlayerName(playerid));
Reply
#5

I only have 1 function, and I don't need another variable for banned, since it's automatically set to 1.

Anyone could have a solution for this problem?

My code looks fine

pawn Код:
format(Query, sizeof(Query), "UPDATE `bans` SET  `Banned` = 1 WHERE Username = '%s'",PlayerName(playerid));
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)