• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

SQL query.

Shadowman321

Member
Joined
Mar 27, 2010
Messages
205
Reaction score
22
Hey. Can anyone tell me how can i change all player skills to 10?
I got error that can't display characters.php because skills does not exist. I tried to use this:
Code:
INSERT INTO `player_skills` (`player_id`, `skillid`, `value`, `count`) VALUES
(3, 0, 10, 0),
(3, 1, 10, 0),
(3, 2, 10, 0),
(3, 3, 10, 0),
(3, 4, 10, 0),
(3, 5, 10, 0),
(3, 6, 10, 0),
(4, 0, 10, 0),
(4, 1, 10, 0),
(4, 2, 10, 0),
(4, 3, 10, 0),
(4, 4, 10, 0),
(4, 5, 10, 0),
(4, 6, 10, 0),
(5, 0, 10, 0),
(5, 1, 10, 0),
(5, 2, 10, 0),
(5, 3, 10, 0),
(5, 4, 10, 0),
(5, 5, 10, 0),
(5, 6, 10, 0);
But i got now more then 100 characters that doesn't work, so...
@edit
Ok, i used excel to do this "sh*t". And it works now. But it would be nice to know something more about queries.
 
Last edited:
update player_skills set value = 10;

Are you an idiot. Aren't you?

If there don't exist any skill for player with id 7-160, how that can help? It will change only 1-6 because that ones exist. And rest of it is deleted.
So i wont work... If you think that should work, you really can't think? If it should, it have to update value of skills for player from id -infinity to +infinity.
So... Don't spam please.

Or if you just can't read, so what are you doing here?
skills does not exist.
 
SQL:
UPDATE player_skills SET value=10, count=0 WHERE skillid=0;
UPDATE player_skills SET value=10, count=0 WHERE skillid=1;
UPDATE player_skills SET value=10, count=0 WHERE skillid=2;
UPDATE player_skills SET value=10, count=0 WHERE skillid=3;
UPDATE player_skills SET value=10, count=0 WHERE skillid=4;
UPDATE player_skills SET value=10, count=0 WHERE skillid=5;
UPDATE player_skills SET value=10, count=0 WHERE skillid=6;
 
Are you an idiot. Aren't you?

If there don't exist any skill for player with id 7-160, how that can help? It will change only 1-6 because that ones exist. And rest of it is deleted.
So i wont work... If you think that should work, you really can't think? If it should, it have to update value of skills for player from id -infinity to +infinity.
So... Don't spam please.

Or if you just can't read, so what are you doing here?

I didn't understand your problem.

SQL:
UPDATE player_skills SET value=10, count=0 WHERE skillid=0;
UPDATE player_skills SET value=10, count=0 WHERE skillid=1;
UPDATE player_skills SET value=10, count=0 WHERE skillid=2;
UPDATE player_skills SET value=10, count=0 WHERE skillid=3;
UPDATE player_skills SET value=10, count=0 WHERE skillid=4;
UPDATE player_skills SET value=10, count=0 WHERE skillid=5;
UPDATE player_skills SET value=10, count=0 WHERE skillid=6;
SQL:
UPDATE player_skills SET value=10, count=0 WHERE skillid BETWEEN 0 AND 6;
 
You didn't need to be rude. Maybe explaining a little bit better your problem you can get the help that you expect. Please make us know if the query's that I or iKaS provided is working to solve your problem (he just shortened my lines) but is working exactly the same.
 
Those queries will update only existing records.
So, it changed onlu value of skills for players with id 1-6.
And players with id 7-161 still doesn't have any skill. Those records just don't exist in DB!
I need to create those records. Insert its to DB.
You'r quesries will update. But...
How can i update something that don't exist?
First i need to create records and then it will works.

So, i needed something that create record of skills id 0-6 for players with id 7 to 161.
And... I want to know, is that possible to make query that create records of skills for all players that exists automatically.
For example, if i have players with id 7-123432 i will insert skills for this players. INSERT not UPDATE. Because that doesn't exist!
But not query where i need to write id of players that i want to create record in skills. I want to take it automatically from 'players' table. Query that will check existing players and then create skills for everyone.
For example:
If exist player with id 25, insert all skills for this player. And then go to player with id 26......
Or just take list of existing players, take their id and then insert for every id that exist in 'players'.
Can anyone understand me now? I can't explain that better then now.

And... Sorry for my behavior. But it was 6 am, so i was tired and wanted some help and understand.
 
Back
Top