How to set up back end system for my idea?

Hi! I need suggestions designing the backend for a system that allows searching of specific houses.
This will be a web based project, hopefully in PHP utilizing mySQL.

Here’s the scenario:

[ul][li] There are many houses in a neighborhood.[/li]
[li] Each house has rooms.[/li]
[li] Each room has items like furniture.[/li]
[li] Each item such as the furniture has related specifications like color, or height.[/li]
[li][/li]
[li] Rooms are priced, along with everything in the room like the furniture.[/li][/ul]

I want to set up the houses data, then be able to search it by strings such as “pink bedroom and a bathroom with a shower for 500$” which will be parsed and perhaps create a mysql search query

I imagine I would use codes like the following:
[php]
bedroom = new room(“bedroom”, 200); //Create a room named “bedroom” priced 200$
bedroom.color = “red”;

restroom = new room(“restroom”);
shower = new item(“shower”, 100);
restroom.addItem(shower);

house = new house(“123 green ave, east lansing, MI”);
house.addRoom(bedroom);
house.addRoom(restroom);

results = findNearbyHousesMatching(“pink bedroom and a bathroom with a shower for 500$”);
[/php]

Thank you in advance for any suggestions!

Before you start writing PHP code you need to design your database and make sure it can handle storing this information efficiently. The way you handle your database in this situation will determine how the PHP and MySQL queries will need to be written. So that’s step 1 and it seems like you have a pretty good idea on how your db will look.

Once you have that you can enter test data and start creating the PHP that will handle the queries.

And by the way, PHP would use ‘->’ instead of ’ . ’ and you need ’ $ ’ in front of your variables.

[php]
$bedroom = new room(‘bedroom’, 200);
$bedroom->color = ‘red’;
[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service