Database wont be deleted.
#1

Hello, i have made an ask system where admins can check last asks.
Now the problem is that when i execute delete ask it wont do anything.
Here is my code.
Код:
COMMAND:dask(playerid,params[]) {
     if(IsPlayerAdmin(playerid)){
     if(isnull(params)) return SendClientMessage(playerid,-1,"usage /dask [name]");
     new Query[250];
     mysql_format(MySQLPipeline, Query, sizeof(Query),"SELECT * FROM `asks` WHERE `Name` = '%e'",params); // read player account
     mysql_tquery(MySQLPipeline, Query, "Deleteask", "i", playerid); // to read if player account exist
     } else return SendClientMessage(playerid,-1,"ERROR:You should be rcon to use this command");
     return 1;
}

forward Deleteask(playerid);
public Deleteask(playerid)
{
 new rows, fields;
 cache_get_data(rows, fields, MySQLPipeline);
 if(rows)
     {
     new Query[250],Name1[MAX_PLAYER_NAME+1];
     cache_get_field_content(0, "Name", Name1, MySQLPipeline, sizeof(Name1));
     format(Query, 100, "DELETE FROM `ask` WHERE `Name` = '%s'", Name1);
     mysql_tquery(MySQLPipeline, Query, "", "");
     SendClientMessage(playerid,-1,"Ask Successfully Deleted");
 } if(!rows) {
     return SendClientMessage(playerid,-1,"Name Not Exist on database");
    }
 return 1;
}
Reply
#2

You could use just mysql_tquery(MySQLPipeline, Query), and rows = cache_num_rows();
Also, could you print the query line? Any MySQL log errors?
Reply
#3

Код:
[23:02:00] DELETE FROM `ask` WHERE `Name` = 'Leonardo_Hena'
same as the database
Reply
#4

If the query has no effect, check your mysql logs. You may not have the privileges to execute a DELETE query (depending on the user you have connected with).

And why do you even need a SELECT query, execute the DELETE query in the command and use cache_affected_rows in the callback specified in mysql_tquery to see if any row was affected (deleted).
Reply
#5

Thanks Konstantinos (repped if can)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)