Preg Match Empty String

You can use ^ to match beginning-of-line, and $ to match end-of-line, thus the regular expression ^$ would match an empty line/string. Your specific example (a line/string containing a single digit or being empty) would easiest be achieved with ^[0-9]?$.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)