I have always this same error and I dont know how to fix it. Anybody can help maybe?
if (isset($_POST['submit'])) {
$char = stripslashes($_POST['char']);
$price = stripslashes($_POST['price']);
$mensagem = "";
$charLevel = $SQL->query('SELECT * FROM players WHERE name = '.$char.'');
foreach($charLevel as $dados){
$level = $dados['level'];
}
foreach($players_from_logged_acc as $player)
{
if ($player->getName() == $char){
$check = 1;
if ($player->isOnline()){
$check = 0;
$mensagem = "Your char is online, please log out before placing it for sale!";
}
if ($player->getLevel() < 8){
$check = 0;
$mensagem = "Your character must have a level greater than 7!";
}
if ($price <= 0 or $price > 10000){
$check = 0;
$mensagem = "Please enter a price from 1 to 10000 Premium Points!";
}
if ($price % 25 != 0){
$check = 0;
$mensagem = "Please enter a positive value and a multiple of 25, example: 25, 50, 75, 100 ...";
}
break;
} else {
$check = 0;
}
}
Error is at line
foreach($charLevel as $dados){