usman07 Posted March 9, 2012 Share Posted March 9, 2012 This is a image of my forms and a image of my mysql table. Have i setting my mysql tables up correctly, im especially unsure about the form which says e.g. number of bedrooms (min) and (max) having my mysql table like this will the form work correctly? Quote Link to comment Share on other sites More sharing options...
cpd Posted March 9, 2012 Share Posted March 9, 2012 Your HTML table wont affect your MySQL table as you should manipulate the input data in PHP to be correctly formatted for when you execute your mysql_query. Quote Link to comment Share on other sites More sharing options...
usman07 Posted March 10, 2012 Author Share Posted March 10, 2012 where my form says minimum of bedrooms to maximum bedrooms how would i set that out in my mysql table? at the moment i just have number of bedrooms?will that still work? Quote Link to comment Share on other sites More sharing options...
cpd Posted March 10, 2012 Share Posted March 10, 2012 I would suggest you create a varchar field and perhaps insert something like "1-5" where 1 is your minimum value and 5 is your maximum. You can then explode this value at the "-" and do whatever you want with the values. Alternatively, you could just create two fields, one called maximum and one called minimum or something more descriptive. Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted March 10, 2012 Share Posted March 10, 2012 Use two fields. It will greatly simplify SELECTing the data later. Quote Link to comment Share on other sites More sharing options...
trq Posted March 11, 2012 Share Posted March 11, 2012 Surely the table is designed to hold properties. Properties have a set number of bedrooms, so the table structure you have is correct. You would then need to select properties that fall into your min max range within your query. eg; SELECT * FROM properties WHERE number_of_bedrooms >= $min and number_of_bedrooms <= $max Also, fix your filed names so that they don't contain spaces. 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.