Koci1994
Banned User
- Joined
- Dec 27, 2008
- Messages
- 807
- Reaction score
- 1
I znow musze zalozyc temat bo zostal zamkniety .
ZROBILEM TAK JAK KULA POWIEDZIAL I NADAL NIE DZIALA
Co w tym jest zle napisane ?
Wywala mi
ZROBILEM TAK JAK KULA POWIEDZIAL I NADAL NIE DZIALA
PHP:
<?php
$voc=array (0 => 'None', 1 => 'Sorcerer', 2 => 'Druid', 3 => 'Paladin', 4 => 'Knight', 5 => 'Master Sorcerer', 6 => 'Elder Druid', 7 => 'Royal Paladin', 8 => 'Elite Knight');
$genderCensus = $SQL->query('SELECT `sex` AS `key`, COUNT(`id`) AS `value` FROM `players` GROUP BY `sex`')->fetchAll(PDO::FETCH_KEY_PAIR);
$vocationCensus = $SQL->query('SELECT `vocation` AS `key`, COUNT(`id`) AS `value` FROM `players` GROUP BY `vocation`')->fetchAll(PDO::FETCH_KEY_PAIR);
// prepares calculation variables
$genderCount = array_sum($genderCensus) / 100;
$vocationCount = array_sum($vocationCensus) / 100;
$main_content .='<h1>Genders</h1>';
$main_content .='<table align="center" width="400px" border="1px">';
$gender = array('male'=> (int) $genderCensus[0] . ' (' . @intval($genderCensus[0] / $genderCount) . '%)','female' => (int) $genderCensus[1] . ' (' . @intval($genderCensus[1] / $genderCount) . '%)');
$main_content .= '<tr><td width="20%">Females: </td><td>'.$gender['female'].'</td></tr>';
$main_content .= '<tr><td width="20%">Males: </td><td>'.$gender['male'].'</td></tr>';
$main_content .='</table>';
$vocations = array();
foreach($voc as $id => $name)
{
$vocations[$name] = (int) $vocationCensus[$id] . ' (' . @intval($vocationCensus[$id] / $vocationCount) . '%)';
}
$main_content .='<h1>Vocations</h1>';
$main_content .='<table align="center" width="400px" border="1px">';
for($i=1; $i<=count($voc); $i++) {
$main_content .='<tr><td width="20%">'.$voc[$i].'</td><td>'.$vocations[$voc[$i]].'</td></tr>';
}
$main_content .='</table>';
?>
Wywala mi
PHP:
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in D:\Programy\xampp\htdocs\census.php on line 2
Parse error: syntax error, unexpected T_STRING in D:\Programy\xampp\htdocs\census.php on line 2