Jump to content

I have a form but am i setting my mysql table correctly?


usman07

Recommended Posts

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?

post-130660-13482403308545_thumb.png

post-130660-13482403309303_thumb.png

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.