jandrews Posted March 22, 2009 Share Posted March 22, 2009 Hi, Its easy enough to display a query with all results beginning with a letter: $query_artists = sprintf("SELECT playlist_music FROM flamplayer_musics WHERE playlist_music LIKE '%s%%' GROUP BY playlist_music ORDER BY playlist_music ASC", ...but what if some of your database entries begin with a number? how do you ask for all results beginning with a number? Quote Link to comment https://forums.phpfreaks.com/topic/150630-what-defines-a-number-in-php/ Share on other sites More sharing options...
trq Posted March 22, 2009 Share Posted March 22, 2009 Sql queries are sql, not php, moving. Quote Link to comment https://forums.phpfreaks.com/topic/150630-what-defines-a-number-in-php/#findComment-791261 Share on other sites More sharing options...
Yesideez Posted March 22, 2009 Share Posted March 22, 2009 You do the same but use a number instead of a letter. Quote Link to comment https://forums.phpfreaks.com/topic/150630-what-defines-a-number-in-php/#findComment-791309 Share on other sites More sharing options...
Maq Posted March 22, 2009 Share Posted March 22, 2009 Found this solution on another forum: Select * from table_name where column REGEXP '^[0-9]'; Quote Link to comment https://forums.phpfreaks.com/topic/150630-what-defines-a-number-in-php/#findComment-791318 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.