forumnz Posted August 22, 2008 Share Posted August 22, 2008 How can this be done. Let's say there is a from with a dropdown box with an option to select from database where id is between 20-30. How is this done? Would it be ...... WHERE `id`="20-30"......? Or what? Thanks! Sam. Link to comment https://forums.phpfreaks.com/topic/120936-select-a-range-from-a-database/ Share on other sites More sharing options...
Fadion Posted August 22, 2008 Share Posted August 22, 2008 You could use: SELECT col1, col2 FROM table WHERE id BETWEEN 20 AND 30 Link to comment https://forums.phpfreaks.com/topic/120936-select-a-range-from-a-database/#findComment-623403 Share on other sites More sharing options...
s1yman Posted August 22, 2008 Share Posted August 22, 2008 I know you can use a greater than AND less than query for dates, so would assume you can do similar thing here. Is your "ID" a unique field or there going to be a random amount of records between any two numbers queried? Link to comment https://forums.phpfreaks.com/topic/120936-select-a-range-from-a-database/#findComment-623406 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.