• 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!

Solved Accidently removed players_skills in my database. Help PLZ!

Status
Not open for further replies.

ItWasAllMe

Banned User
Joined
Feb 15, 2013
Messages
269
Reaction score
32
So, I accidently removed all values in players_skills on my server. This results in server crashing if someone tries to login and it gives me the error "Error ID: More info: Player::getSkill() - Skill 0 does not exist" when I try to view a character on the site. I was wondering if there is any SQL query I can do so that it adds skills to all my existing players? Right now there's 0 values in player_skills, I would like to make so that everyone gets 10 in all skills again.
 
Last edited by a moderator:
Solution
hmm ok. I will have to increase efficiency then, hold on.

Lets see how many players we can crunch through with this script:

PHP:
<?php require_once 'engine/init.php';

$Splayers = 0;
$Salready = 0;
$Sfixed = 0;

$players = mysql_select_multi("SELECT `id` FROM `players`;");
if ($players !== false) {
	$Splayers = count($players);
	foreach ($players as $char) {

		// Check if player have skills
		$skills = mysql_select_single("SELECT `value` FROM `player_skills` WHERE `player_id`='". $char['id'] ."' AND `skillid`='2' LIMIT 1;");

		// If he dont have any skills
		if ($skills === false) {
			$Sfixed++;

			// Loop through every skill id and give him default skills.
			$query = "INSERT INTO `player_skills` (`player_id`, `skillid`, `value`...
With Znote AAC:

1: Create a file in www directory called repair.php

2: Paste this inside and save it:
PHP:
<?php require_once 'engine/init.php';

$Splayers = 0;
$Salready = 0;
$Sfixed = 0;

$players = mysql_select_multi("SELECT `id` FROM `players`;");
if ($players !== false) {
	$Splayers = count($players);
	foreach ($players as $char) {

		// Check if player have skills
		$skills = mysql_select_single("SELECT `id` FROM `player_skills` WHERE `player_id`='". $char['id'] ."' LIMIT 1;");

		// If he dont have any skills
		if ($skills === false) {
			$Sfixed++;

			// Loop through every skill id and give him default skills.
			for ($i = 0; $i < 7; $i++) {
				mysql_insert("INSERT INTO `player_skills` (`player_id`, `skillid`, `value`, `count`) VALUES ('". $char['id'] ."', '$i', '10', '0');");
			}
		} else $Salready++;
	}
	?>
	<h1>Script run status:</h1>
	<p>Players detected: <?php echo $Splayers; ?></p>
	<p>Players already fixed: <?php echo $Salready; ?></p>
	<p><b>Repaired players: <?php echo $Sfixed; ?></b></p>
	<?php
} else {
	?>
	<h1>No players detected.</h1>
	<p>Something went wrong.</p>
	<?php
}
?>

<h1>Script run completed.</h1>
<p>Script created by <a href="http://otland.net/members/znote/">Znote</a> for Znote AAC users</p>

3: Visit yourWebsite.com/repair.php

And problem solved. Tho they will get default skills since its impossible to know what skills they had since you well, deleted them. :p
 
Last edited:
With Znote AAC:

1: Create a file in www directory called repair.php

2: Paste this inside and save it:
PHP:
<?php require_once 'engine/init.php';

$Splayers = 0;
$Salready = 0;
$Sfixed = 0;

$players = mysql_select_multi("SELECT `id` FROM `players`;");
if ($players !== false) {
	$Splayers = count($players);
	foreach ($players as $char) {

		// Check if player have skills
		$skills = mysql_select_single("SELECT `id` FROM `player_skills` WHERE `player_id`='". $char['id'] ."' LIMIT 1;");

		// If he dont have any skills
		if ($skills === false) {
			$Sfixed++;

			// Loop through every skill id and give him default skills.
			for ($i = 0; $i < 7; $i++) {
				mysql_insert("INSERT INTO `player_skills` (`player_id`, `skillid`, `value`, `count`) VALUES ('". $char['id'] ."', '$i', '10', '0');");
			}
		} else $Salready++;
	}
	?>
	<h1>Script run status:</h1>
	<p>Players detected: <?php echo $Splayers; ?></p>
	<p>Players already fixed: <?php echo $Salready; ?></p>
	<p><b>Repaired players: <?php echo $Sfixed; ?></b></p>
	<?php
} else {
	?>
	<h1>No players detected.</h1>
	<p>Something went wrong.</p>
	<?php
}
?>

<h1>Script run completed.</h1>
<p>Script created by <a href="http://otland.net/members/znote/">Znote</a> for Znote AAC users</p>

3: Visit yourWebsite.com/repair.php

And problem solved. Tho they will get default skills since its impossible to know what skills they had since you well, deleted them. :p

Holy shiet, more advanced than I thought. Thanks alot!!

Got this error:
Code:
string(63) "SELECT `id` FROM `player_skills` WHERE `player_id`='1' LIMIT 1;" 
(query - SQL error) 
Type: select_single (select single row from database)

Unknown column 'id' in 'field list'

I was using gesiors acc before, installed Znote AAC to run the script, any idea what could be wrong?
 
Last edited:
Yeah sorry, a small typo. x)

Here you go:
PHP:
<?php require_once 'engine/init.php';

$Splayers = 0;
$Salready = 0;
$Sfixed = 0;

$players = mysql_select_multi("SELECT `id` FROM `players`;");
if ($players !== false) {
	$Splayers = count($players);
	foreach ($players as $char) {

		// Check if player have skills
		$skills = mysql_select_single("SELECT `value` FROM `player_skills` WHERE `player_id`='". $char['id'] ."' AND `skillid`='2' LIMIT 1;");

		// If he dont have any skills
		if ($skills === false) {
			$Sfixed++;

			// Loop through every skill id and give him default skills.
			for ($i = 0; $i < 7; $i++) {
				mysql_insert("INSERT INTO `player_skills` (`player_id`, `skillid`, `value`, `count`) VALUES ('". $char['id'] ."', '$i', '10', '0');");
			}
		} else $Salready++;
	}
	?>
	<h1>Script run status:</h1>
	<p>Players detected: <?php echo $Splayers; ?></p>
	<p>Players already fixed: <?php echo $Salready; ?></p>
	<p><b>Repaired player accounts: <?php echo $Sfixed; ?></b></p>
	<?php
} else {
	?>
	<h1>No players detected.</h1>
	<p>Something went wrong.</p>
	<?php
}
?>

<h1>Script run completed.</h1>
<p>Script created by <a href="http://otland.net/members/znote/">Znote</a> for Znote AAC users</p>
 
Alright, now it adds skills up to player id 217. So it seems to be working, but I get this error:
Code:
Fatal error: Maximum execution time of 30 seconds exceeded in C:\xampp\htdocs\znoteaac\engine\database\connect.php on line 228
And after that I can't execute the script again, only if I delete all values in player_skills again. I suppose it's some kind of security thing and I tried highering values in config.php but it still gives me the same error.
 
hmm ok. I will have to increase efficiency then, hold on.

Lets see how many players we can crunch through with this script:

PHP:
<?php require_once 'engine/init.php';

$Splayers = 0;
$Salready = 0;
$Sfixed = 0;

$players = mysql_select_multi("SELECT `id` FROM `players`;");
if ($players !== false) {
	$Splayers = count($players);
	foreach ($players as $char) {

		// Check if player have skills
		$skills = mysql_select_single("SELECT `value` FROM `player_skills` WHERE `player_id`='". $char['id'] ."' AND `skillid`='2' LIMIT 1;");

		// If he dont have any skills
		if ($skills === false) {
			$Sfixed++;

			// Loop through every skill id and give him default skills.
			$query = "INSERT INTO `player_skills` (`player_id`, `skillid`, `value`, `count`) VALUES ";

			for ($i = 0; $i < 7; $i++) {
				if ($i != 6) $query .= "('". $char['id'] ."', '$i', '10', '0'), ";
				else $query .= "('". $char['id'] ."', '$i', '10', '0');";
			}
			
			mysql_insert($query);
		} else $Salready++;
	}
	?>
	<h1>Script run status:</h1>
	<p>Players detected: <?php echo $Splayers; ?></p>
	<p>Players already fixed: <?php echo $Salready; ?></p>
	<p><b>Repaired player accounts: <?php echo $Sfixed; ?></b></p>
	<?php
} else {
	?>
	<h1>No players detected.</h1>
	<p>Something went wrong.</p>
	<?php
}
?>

<h1>Script run completed.</h1>
<p>Script created by <a href="http://otland.net/members/znote/">Znote</a> for Znote AAC users</p>

Btw, how many players do you have in your db?
 
Last edited:
Solution
Thanks alot!
It worked now and my database has 1.2k players, Znote AAC seems awesome too I will definitely try it out instead of Gesior! :p
 
Just use:
set_time_limit(0);

or:
set_time_limit(100000);
 
You need to use ZnoteACC to use his script, just install it and use the script then u can go back to gesior again
 
It's solved. I made this thread you dam pleb.

So I assume that you also accidently removed all your players skill tables? Then you need to use Znote's script and his AAC to get all skills back.
 
Status
Not open for further replies.
Back
Top