MYSQL select Like (not letters)<

I have the following to retrieve game names beginning with whatever $alp is, but what value would $alp need to be to choose games that don't begin with a letter - eg 0-9 . / - etc?

$query = "SELECT GAME_NAME FROM game_table WHERE console='PS2' AND GAME_NAME LIKE '$alp%' ORDER BY GAME_NAME DESC";Just set $alp to a number in the rest of your PHP like you do with the letters. Or if you need to select them all in one go, it's probably easier to query them all then pick out the ones you need with a preg_match().$query = "SELECT GAME_NAME FROM game_table WHERE console='PS2' AND GAME_NAME NOT REGEXP(\"^[a-zA-Z]\") ORDER BY GAME_NAME DESC";Thanks - just what I neeeded :)
 
Back
Top