... globalize statement ... if(!is_int($siteid)) { ... trip your error checking facility ... } else { ... the rest of your statement ... }