ItsWesYo Posted July 21, 2007 Share Posted July 21, 2007 I've gotten it to display only certain letters, but what would I put to display ALL items that start with numbers? This is what I have to display certain letters: <?php case "A": $result = mysql_query("SELECT * FROM items WHERE name LIKE 'A%'"); while($r=mysql_fetch_assoc($result)) { $name=$r['name']; echo "$name<br>"; } mysql_free_result($result); break; ?> I want to display ALL numbers, not just individually. Link to comment https://forums.phpfreaks.com/topic/61100-displaying-numbers/ Share on other sites More sharing options...
Barand Posted July 21, 2007 Share Posted July 21, 2007 $result = mysql_query("SELECT * FROM items WHERE SUBSTRING(name,1) IN ('0','1','2','3','4','5','6','7','8','9') "); Link to comment https://forums.phpfreaks.com/topic/61100-displaying-numbers/#findComment-304082 Share on other sites More sharing options...
Barand Posted July 21, 2007 Share Posted July 21, 2007 Correction that should be "SUBSTRING(name,1,1)" in the above query Link to comment https://forums.phpfreaks.com/topic/61100-displaying-numbers/#findComment-304097 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.