Valid ID
This very short, but useful, codesnippet allows you to quickly validate a numeric ID, often used in a database table.
function valid_id($id) {
if (empty($id) || !is_numeric($id)) {
return false;
} else {
return true;
}
}
?>