kpetsche20 Posted January 3, 2009 Share Posted January 3, 2009 How do you select values from a MySQL database that only start with numbers Link to comment https://forums.phpfreaks.com/topic/139369-how-do-you-select-values-from-mysql-that-only-start-with-numbers/ Share on other sites More sharing options...
ratcateme Posted January 3, 2009 Share Posted January 3, 2009 i think you need to retrieve all values then you could use php like this if(is_numeric(substr($row['field'],0,1))){ //starts with a number } Scott. Link to comment https://forums.phpfreaks.com/topic/139369-how-do-you-select-values-from-mysql-that-only-start-with-numbers/#findComment-728952 Share on other sites More sharing options...
kenrbnsn Posted January 3, 2009 Share Posted January 3, 2009 I would use the mysql substr() function: <?php $q = "select somefield from table where substr(somefield,1,1) in '0,1,2,3,4,5,6,7,8,9'; ?> Note: untested. Ken Link to comment https://forums.phpfreaks.com/topic/139369-how-do-you-select-values-from-mysql-that-only-start-with-numbers/#findComment-728959 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.