It's even hard to ask because I do not know if it's okay, but I'll try to explain it as best I can. I have a page where I will use the php switch case to decide the action according to what is passed. However, if the page is only triggered without passing any parameters, it should check the following:
$query = "SELECT * FROM duelos WHERE data > UNIX_TIMESTAMP() - 1440 AND (iddesafiante=$desafiante AND iddesafiado=$desafiado) OR (iddesafiante=$desafiado AND iddesafiado=$desafiante)";
$statement = $mysqli->prepare($query);
//bind parameters for markers, where (s = string, i = integer, d = double, b = blob)
$statement->bind_param(ii, $iddesafiante, $iddesafiado);
if($statement->execute()){
print 'Success! Ja duelou com esse oponente nas ultimas 24horas <br />';
}else{
die('Error : ('. $mysqli->errno .') '. $mysqli->error);
}
$statement->close();
After the first check, make the decisions accordingly, if something happens
$acao = $_GET (acao);
switch($acao) {
case desafiar: {
QUERY 1
break;
}
case recusar: {
query 2
break;
}
}
}