dbx Posted November 7, 2008 Share Posted November 7, 2008 my db holds the size of something in metres. I know the size won't realistically be over 10,000, but I want to include any possible number. At the moment, I have "where id between 0 and 9999999999999" Surely there is a better way to do this? Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/131759-solved-select-from-db-where-id-between-0-and-no-maximum-how-can-you-specify-no-max/ Share on other sites More sharing options...
beansandsausages Posted November 7, 2008 Share Posted November 7, 2008 select from db WHERE id = > 0 maybe somthing like that? Quote Link to comment https://forums.phpfreaks.com/topic/131759-solved-select-from-db-where-id-between-0-and-no-maximum-how-can-you-specify-no-max/#findComment-684408 Share on other sites More sharing options...
dbx Posted November 7, 2008 Author Share Posted November 7, 2008 sorry, I should have explained it a little better. the query is generated from form results, and sometimes it will be "between 0 and 10" etc one of the options is "No Maximum" and its value is currently set to 999999999999 Quote Link to comment https://forums.phpfreaks.com/topic/131759-solved-select-from-db-where-id-between-0-and-no-maximum-how-can-you-specify-no-max/#findComment-684410 Share on other sites More sharing options...
Mchl Posted November 7, 2008 Share Posted November 7, 2008 So when user chooses a maximum value do a query: SELECT * FROM table WHERE ID > $min AND ID < $max; And if he/she chooses 'no maximum' just omit 'AND ID < max' part Alternatively, if you selected ID to be UNSIGNED INTEGER, you might use 4294967295 as a maximum value. http://dev.mysql.com/doc/refman/5.1/en/numeric-types.html Quote Link to comment https://forums.phpfreaks.com/topic/131759-solved-select-from-db-where-id-between-0-and-no-maximum-how-can-you-specify-no-max/#findComment-684414 Share on other sites More sharing options...
dbx Posted November 7, 2008 Author Share Posted November 7, 2008 thanks. so there is no keyword or anything that can be used to say "no maximum"? Quote Link to comment https://forums.phpfreaks.com/topic/131759-solved-select-from-db-where-id-between-0-and-no-maximum-how-can-you-specify-no-max/#findComment-684425 Share on other sites More sharing options...
Mchl Posted November 7, 2008 Share Posted November 7, 2008 No, because 'no maximum' is equivalent to not indicating upper limit. No need for separate keyword. Quote Link to comment https://forums.phpfreaks.com/topic/131759-solved-select-from-db-where-id-between-0-and-no-maximum-how-can-you-specify-no-max/#findComment-684437 Share on other sites More sharing options...
dbx Posted November 7, 2008 Author Share Posted November 7, 2008 ok. thanks for your help guys. Quote Link to comment https://forums.phpfreaks.com/topic/131759-solved-select-from-db-where-id-between-0-and-no-maximum-how-can-you-specify-no-max/#findComment-684440 Share on other sites More sharing options...
fenway Posted November 7, 2008 Share Posted November 7, 2008 thanks. so there is no keyword or anything that can be used to say "no maximum"? If there's no max, then don't include that criterion in the search. Quote Link to comment https://forums.phpfreaks.com/topic/131759-solved-select-from-db-where-id-between-0-and-no-maximum-how-can-you-specify-no-max/#findComment-684531 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.