1
It is even difficult to ask because I do not know if this is right, but I will try to explain it in the best way possible. I have a page where I will use the php case switch to decide the action according to what is passed. However, I need the page if it is only triggered without passing any parameters it makes the following check:
$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();
Dai after the first check take the settlement decisions if something is passed
$acao = $_GET (acao);
switch($acao) {
case desafiar: {
QUERY 1
break;
}
case recusar: {
query 2
break;
}
}
}
Play this code on
default
switch, http://php.net/manual/en/control-structures.switch.php– rray
that was put in the answer so I mark as a solution
– Arsom Nolasco