thefollower Posted November 22, 2007 Share Posted November 22, 2007 Hey guys quick question Say theres a limit of number choices from 1 to 10. (not including 0) Now these numbers are buyable so say some one buys number 7. With a query or what ever is needed i need to find a way for the screen to then display: 1 2 3 4 5 6 8 9 10. As you notice 7 is not missing.. but it could be any number and more than one number that has already been taken... How can this be done in PHP and MYSQL or will it require some other script? Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted November 22, 2007 Share Posted November 22, 2007 At it's simplest: <?php $choices = array(1,2,3,4,5,6,7,8,9,10); $used = array(5,7); $possible = array_diff($choices,$used); $possible = implode(',',$possible); echo $possible; ?> It really depends on what its for as to how you would actually do it. Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted November 22, 2007 Share Posted November 22, 2007 sql will be your best way to do it setting a row status different Quote Link to comment Share on other sites More sharing options...
thefollower Posted November 22, 2007 Author Share Posted November 22, 2007 Well i can tell you in a more complex way: Say you want to buy a house in a street.. so you pick the street then it gets all houses in that street.. when it has got all these houses it will know what numbers are already taken... processing wise i can easily do a validation check. But to stop users guessing which house numbers are not free by constantly inputting numbers.. I would rather it echo out the numbers that are still available from stripping out the numbers that are taken from the string then echo it. 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.