Raymart Calinao AsthreA Raymart Calinao AsthreA - 1 year ago 106
MySQL Question

filter result of mysql by numerical

I would like to filter the result of first character by any numerical(0-9)

in filtering by letters i use this code

$stmt = $db->prepare("SELECT * FROM pages WHERE LEFT(`title`, 1)='$letter' order by title ASC LIMIT :limit, :perpage");

if i tried to change the value of variable
it only returns all the results character starting 0..if possible i would like to get all the numerical value

my goal was to create a navigator filtering them all by letter and number like this one
enter image description here

Answer Source

You can use REGEXP

FROM pages 
WHERE title REGEXP '^[0-9]'
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download