[MYSQL] Rank saving problem.
#1

Hey guys, I'm having a problem with faction ranks saving. Basically what happens is I type /editranks and when I change the name, it changes the name in game, but it dosen't update/change it on the mysql database in phpmyadmin. It pretty much does this for all ranks, here is what one of the ranks coding is like its all the same just a different rank.

pawn Код:
case DIALOG_RANK2:
{
    new query[400];
    format(Factions[PlayerInfo[playerid][Faction]][Rank2], MAX_PLAYER_NAME, "%s", inputtext);
    format(query, sizeof(query), "UPDATE Factions SET Rank2 = '%s' WHERE ID ='%d'", inputtext, PlayerInfo[playerid][Faction]);
    mysql_query(query);
}
Any help is appreciated, thanks.
Reply
#2

Ew, ew, raw user input inserted into a query! Very prone to SQL injection!

Post mysql_log.
Reply
#3

- deleted
Reply
#4

Quote:
Originally Posted by Vince
Посмотреть сообщение
Ew, ew, raw user input inserted into a query! Very prone to SQL injection!

Post mysql_log.
Hahaha.

This is what it shows when I actually change the rank, it only changes it in game, but not in the database like I said :P. Log:

Код:
[15:05:55] >> mysql_query( Connection handle: 1 )

[15:05:55] CMySQLHandler::Query(UPDATE Factions SET Rank = 'Cadet Test' WHERE ID ='1') - An error has occured. (Error ID: 1054, Unknown column 'ID' in 'where clause')
Reply
#5

Do you actually have a column named "ID"?
Reply
#6

Quote:
Originally Posted by JJones432
Посмотреть сообщение
Do you actually have a column named "ID"?
Not ID, but there is one called SQLID.
Reply
#7

pawn Код:
case DIALOG_RANK2:
{
    new query[400];
    format(Factions[PlayerInfo[playerid][Faction]][Rank2], MAX_PLAYER_NAME, "%s", inputtext);
    format(query, sizeof(query), "UPDATE Factions SET Rank2 = '%s' WHERE ID = %d", inputtext, PlayerInfo[playerid][Faction]);
    mysql_query(query);
}
Edit: If the column is named SQLID then instead of ID put SQLID
Reply
#8

Quote:
Originally Posted by Adytza.
Посмотреть сообщение
pawn Код:
case DIALOG_RANK2:
{
    new query[400];
    format(Factions[PlayerInfo[playerid][Faction]][Rank2], MAX_PLAYER_NAME, "%s", inputtext);
    format(query, sizeof(query), "UPDATE Factions SET Rank2 = '%s' WHERE ID = %d", inputtext, PlayerInfo[playerid][Faction]);
    mysql_query(query);
}
Edit: If the column is named SQLID then instead of ID put SQLID
That worked, thanks. Thanks to all who helped
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)