This is not dieing as I expected it to, if $key is not a value in the key_code column of the database. Instead it just continues. I’m probably missing something really simple.
$key = $_GET['k'];
$keycheck = mysql_query("SELECT * FROM ib_dist WHERE key_code = '$key'");
if (!$keycheck) {
die("A database error has occured.");
} else {
try checking the amount of rows found.