Revision: 17330
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at September 1, 2009 09:32 by acosonic
Initial Code
//selecting user based on his personal ID number if(filter_var($var, FILTER_VALIDATE_INT)) $sql = "select * from user where JMBG='$var'"; //selecting user based on his email else if(filter_var($var, FILTER_VALIDATE_EMAIL)) $sql = "select * from user where email='$var'"; //selecting user based on his username else $sql = "select * from user where username='$var'";
Initial URL
Initial Description
This code generates SQL depending on semantic type of variable from user input. php>5.2
Initial Title
Using PHP's filter_var to validate email or number
Initial Tags
Initial Language
PHP