Trying to make this set Arrested = 1 for all ID's in table.
#1

This only sets the arrested = 1 for the last table it dealt with.

pawn Код:
format(query, sizeof(query), "UPDATE `arecords` SET arrested = 1 WHERE id = %d", PlayerArrests[giveplayerid][ar_id]);
    mysql_query(query);
pawn Код:
format(string, sizeof(string), "SELECT * FROM `arecords` WHERE `PSQLID`= %d AND `Arrested`=0", PlayerSQLID[giveplayerid]);
    mysql_query(string);
    mysql_store_result();
    new r_msg[500];

    new totaltime = 0;
    //while(mysql_fetch_row(r_msg, "|"))
    while(mysql_fetch_row(r_msg))
    {
        sscanf(r_msg, "p<|>e<iiiis[24]ii>", PlayerArrests[giveplayerid]);
        totaltime += PlayerArrests[giveplayerid][ar_ti]; //same here, you'll have to change it to the fieldname that says how long he should be arrested for THAT ONE crim
    }
Where it retrieves.

Could anyone assist me?
Reply
#2

pawn Код:
mysql_query("UPDATE arecords SET arrested = 1");
Reply
#3

It has to set it for the specific IDS, that's the problem. As in, where PlayerSQLID == playerid.
Reply
#4

Why just not setting it this way?
UPDATE `arecords` SET arrested = 1 WHERE player_name = %s
(i just changed id to player_name)
Reply
#5

The code you had would update the table and set "arrested" to 1 to any field with "id" equal to the value of PlayerArrests[giveplayerid][ar_id]. In the title you wrote "Trying to make this set Arrested = 1 for all ID's in table." that's why I posted a query that sets any row (assuming each row has a different ID) to 1 but above you said that it has to set it to specific IDs so you confused me about what you really want. Would you mind to explain better?

EDIT: He got it fixed.
Reply
#6

All SQLID's are relative to the playersqlid, so it shouldn't make a difference, really?

EDIT:

I'm really sorry Konstantinos, You're right I should have explained better.


The command, checks all arrest records for the playerid's SQLID. If the time > 0 and arrested = 0 then it adds all of the time together and (should but thats the problem) sets the arrested = 1. (Then sets jail pos etc)
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)