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. Quote Link to comment 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') "); Quote Link to comment 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 Quote Link to comment 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.