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

Column 'time' error

sobek07

Chce być fajny
Joined
Nov 16, 2009
Messages
231
Reaction score
0
Location
Poland / Poznań
PHP:
<?PHP
$players_deaths_data = $SQL->query('SELECT * FROM players,player_deaths WHERE players.id = player_deaths.player_id ORDER BY time DESC LIMIT '.$config['site']['last_deaths_limit']);
$number_of_players_deaths = 0;
if(!empty($players_deaths_data))
{
	$vowels = array("e", "y", "u", "i", "o", "a");
	foreach($players_deaths_data as $dead)
	{
		$number_of_players_deaths++;
		if(is_int($number_of_players_deaths / 2))
			$bgcolor = $config['site']['darkborder'];
		else
			$bgcolor = $config['site']['lightborder'];
		$players_rows .= '<TR BGCOLOR="'.$bgcolor.'"><TD WIDTH="30"><center>'.$number_of_players_deaths.'.</center></TD><TD WIDTH="125"><small>'.date("j.m.Y, G:i:s",$dead['time']).'</small></TD><TD><a href="?subtopic=characters&name='.urlencode($dead['name']).'"><b>'.$dead['name'].'</b></a> killed at level <b>'.$dead['level'].'</b> by ';
		if(is_numeric($dead['killed_by']))
		{
			$player_char = new OTS_Player();
			$player_char->load($dead['killed_by']);
			if($player_char->isLoaded())
				$players_rows .= '<a href="?subtopic=characters&name='.urlencode($player_char->getName()).'"><b>'.$player_char->getName().'</b></a>';
			else
				$players_rows .= '<b>DELETED PLAYER</b>';
		}
		else
			if($dead['killed_by'] == "-1")
				$players_rows .= "item or field";
			else
			{
				if(in_array(substr(strtolower($dead['killed_by']), 0, 1), $vowels))
					$players_rows .= "an ";
				else
					$players_rows .= "a ";
				$players_rows .= $dead['killed_by'];
			}
		if(!empty($dead['altkilled_by']) && $dead['killed_by'] != $dead['altkilled_by'])
			if(is_numeric($dead['altkilled_by']))
			{
				$player_char = new OTS_Player();
				$player_char->load($dead['altkilled_by']);
				if($player_char->isLoaded())
					$players_rows .= ' and <a href="?subtopic=characters&name='.urlencode($player_char->getName()).'"><b>'.$player_char->getName().'</b></a>';
				else
					$players_rows .= '<b>DELETED PLAYER</b>';
			}
			else
				if($dead['altkilled_by'] == "-1")
					$players_rows .= "item or field";
				else
				{
					if(in_array(substr(strtolower($dead['altkilled_by']), 0, 1), $vowels))
						$players_rows .= " and an ";
					else
						$players_rows .= " and a ";
					$players_rows .= $dead['altkilled_by'];
				}
		$players_rows .= '.</TD><TD>'.$config['site']['worlds'][(int) $dead['world_id']].'</TD></TR>';
	}
}
if($number_of_players_deaths == 0)
	$main_content .= '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR="'.$config['site']['vdarkborder'].'"><TD CLASS=white><B>Last Deaths</B></TD></TR><TR BGCOLOR='.$config['site']['darkborder'].'><TD><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=1><TR><TD>No one died on '.$config['server']['serverName'].'.</TD></TR></TABLE></TD></TR></TABLE><BR>';
else
	$main_content .= '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR="'.$config['site']['vdarkborder'].'"><TD CLASS=white><B>Last Deaths</B></TD></TR></TABLE><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%>'.$players_rows.'</TABLE>';
?>

Code:
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'time' in order clause is ambiguous' in C:\xampp\htdocs\czcz\latestkill.php:2 Stack trace: #0 C:\xampp\htdocs\czcz\latestkill.php(2): PDO->query('SELECT * FROM p...') #1 C:\xampp\htdocs\czcz\index.php(125): include('C:\xampp\htdocs...') #2 {main} thrown in C:\xampp\htdocs\czcz\latestkill.php on line 2

Could anyone help?
 
Back
Top