The script below puts the input text into an array, it will then check each individual character for a numeric value. If it finds one it will let you know, other wise it will tell you everything is fine. I'm not sure if there is a more efficient way of doing this, but if you just use is_numeric($value) PHP: and the value is h3llo it will will output telling you it is fine. <?php $str = "H3llo Friend"; $max = strlen($str); $arr1 = str_split($str); $number = 0; foreach ($arr1 as $value){ if (is_numeric($value)) { echo "Number found!"; exit(); } else { $number++; } } if ($number == $max){ echo "<p>All fine!</p>"; } ?> PHP: Please let me know if there is an easier more efficient way of doing this thanks.
if(preg_match('\d', $str)) { echo 'String contains a number'; }else{ echo 'No number found'; } PHP: Something like that?
Warning: preg_match() [function.preg-match]: Delimiter must not be alphanumeric or backslash in /home/n33t/www/www/numeric.php on line 5 No number found Code (markup): That didn't seem to work.
Just looking at your mysql_real_escape_string and sprintf function. Does this prevent SQL Injection? function mressf() { $args = func_get_args(); if (count($args) < 2) return false; $query = array_shift($args); $args = array_map('mysql_real_escape_string', $args); array_unshift($args, $query); $query = call_user_func_array('sprintf', $args); return $query; } PHP: