Database wont be deleted. - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Database wont be deleted. (
/showthread.php?tid=619928)
Database wont be deleted. -
ThatFag - 23.10.2016
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;
}
Re: Database wont be deleted. -
ranme15 - 23.10.2016
You could use just mysql_tquery(MySQLPipeline, Query), and rows = cache_num_rows();
Also, could you print the query line? Any MySQL log errors?
Re: Database wont be deleted. -
ThatFag - 23.10.2016
Код:
[23:02:00] DELETE FROM `ask` WHERE `Name` = 'Leonardo_Hena'
same as the database
Re: Database wont be deleted. -
Konstantinos - 24.10.2016
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).
Re: Database wont be deleted. -
ThatFag - 24.10.2016
Thanks Konstantinos

(repped if can)