How can I translate to PHP syntax something like that:
if(isset($_GET['q'])//but q=is not empty or <2 because in this case redirect to) { do this } else { do this one }
I hope it's not too massy.
Thanks.
updated question
Why this code does not redirect ?
if(isset($_GET['q']))
{
if(!empty($_GET['q']) || $_GET['q']>2)
{
$q = $_GET['q'];
$q = mysql_real_escape_string($q);
$sql = $db->prepare ('SELECT * FROM t WHERE a = :a');
$sql->bindParam(':a',$q);
$sql->execute();
}
else
{
header("Location:somepage.php");
}
} else {
$sql = $db->prepare ('SELECT * FROM t ORDER BY b');
$sql->execute();
}
<?andphp.. Remove that and give a shot.page.php?q=which means there is no value passed forq