jbradley04 Posted December 31, 2012 Share Posted December 31, 2012 I have a question... I am trying to figure out how I can search my database for the next available spot open, and if it is not available then the next available in another row. My example is this.... If I have name1, name 2, name3, name4, name5 and the data is joe, jon, tim, null, null Also, this is not always the same... I have many tables like this but some have name1, name 2 while some go up to name10. I need one statement to search any one of these.... How can I do a search that says select the open name in that row. If there are no open rows move to next row and check. I was thinking a loop but not sure how that would work. I appreciate the help! I hope this all makes sense! Quote Link to comment https://forums.phpfreaks.com/topic/272536-need-some-help-searching-mysql/ Share on other sites More sharing options...
PFMaBiSmAd Posted December 31, 2012 Share Posted December 31, 2012 Your database design is bad, making this task about 5 times harder than it needs to be. You should be storing each separate piece of information in its own row in your table. Then the task would be easy, just add a row and if you are trying to limit the number of entires, just count how many of them there are, by getting a count of the matching rows. Quote Link to comment https://forums.phpfreaks.com/topic/272536-need-some-help-searching-mysql/#findComment-1402293 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.