I have some code that checks for a value of say, var in the link.
Http://www.blah.com/index.php?var=
But when a link like that is sent to the server it returns a database error since var isn't set. I have tried isset (which it is set so that wont stop it) but !empty doesn't stop the var from being sent to the DB.
This is the code
if(isset($_GET['id']) && !empty($_GET['id'])){
$id = mysql_prep($_GET['id']);
....
}
Any help?
$id = isset($_GET['id']) ? (int)$_GET['id'] : 0;
if($id){
$id = mysql_prep($id);
....
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With