Jump to content

mysql table help


Shadycuz

Recommended Posts

Hey guys,

My name is Levi and I'm a High School student. My knowledge with PHP and mysql is limited. I Already have PHP and mysql Installed and working fine. I use phpmyadmin to administrate the database. I have every thing set up fine but I would like some assistance on setting up my tables. Recenty I have undergone the project of setting up a fake realtors website for a school project.

Back the the subject, the problem I'm having is adding a Field to my table that will have the houses being sold in. I want to have a field where I can set a price range like 40,000-60,000 dollar houses and ect. I haven't been able to figure out which type it is like int or enum. I also was wondering if I needed a different table for each price bracket.  Remember this will all need to be search able from a php form. For example if you wanted to search for a house by price range you would select the range from a drop down box on the search page, or by location or number of bed rooms ect. ect.  I hope I explained this clearly and you can help me finish my database so i can start on the php. Thx for taking the time to read this. I will check back offten for the deadline for this is just a few months away.

Sincerely,
Levi
Link to comment
Share on other sites

[quote author=jsladek link=topic=116713.msg476726#msg476726 date=1164946157]
You should only have 1 feild. The price of the house.  If the user wants to see all houses in a range you use SQL to select those houses

-John
[/quote]

Of course... I actually thought the poster wanted the houses to have a high & low price.
Link to comment
Share on other sites

[quote author=jsladek link=topic=116713.msg476726#msg476726 date=1164946157]
You should only have 1 feild. The price of the house.  If the user wants to see all houses in a range you use SQL to select those houses

-John
[/quote]

Thanks for the reply but how would I add a search in php code? I need this so the user end can search my database. I would like for their to be a drop down menue that has choices like 30,000-40,000 and 50,000-60,000 ect. I will try to add one field on my own and see if i can get the prices to work. But any help with the php search is greatly appreciated.
Link to comment
Share on other sites

take http://realtor.com/ for example. They have two selection boxes one for highprice and one for low price.  Looks like they have some Javascript verifing the feilds too... anyhow once you have the two prices you would create your SQL based on them.

You will have to work on the SQL to get it right but I would expect it to look like one of the following might work.  The first one, I was using a similar SQL but with dates not house prices but I think it should be ok.

[code]$sql_house_data="SELECT * FROM house_data WHERE  house_price between '$lowprice' and '$highprice'";[/code]

Or maybe this one if that is not working..

[code]$sql_house_data="SELECT * FROM user_data WHERE house_price  >= '$lowprice' AND house_price  <= '$highprice'";[/code]


-John
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.