need php efficiency for realty to save me

MadJuggla9

2[H]4U
Joined
Oct 9, 2002
Messages
3,515
im new to php but just like any other language, its easy to pickup basic syntax and write simple code. ive been using url variables to save coding and client loading times. i am now doing a website for a local realty company and they need it organized like so:

type of land (3)
-- price of land (4)
-- -- town land is in (7)
-- -- -- listings (up to 15)

now, seeing as i have no database knowledge whatsoever, and little php knowledge. i kinda hardcoded it all very inefficiently, but it works perfectly fine. they have 3 types of land (residential, farm, and commercial), each category has 4 price ranges (0-49k, 50-75k, 75-100k, and 100k+) then each of the prices must have a town to choose from in that range (there are 7 towns in the county they cover), each of the towns in that price range will have up to 15 listings *houses for sale* at a time. so i put 15 folders in each of the ending categories named by numbers *1,2,3, etc ... *

for the main page, i have the design and i use a php include statement to load the content area. well ... when i want to reload the content area with a page other than what the main navigation has *for instance: the pricings, towns, and each of the listings* i am making it call back to the index file for the overall site and giving every single page a name bc otherwise the links other than navigation will want to use the entire window. *i hope im making sense*

so i have a variable name for every single individual listing for 7 towns, in 4 different pricing categories, in 3 different types of land. and each town has 15 folders bc they said the maximum houses for sale at any given time would be 15. as you can see .... more than 70% of my .com index file is simply URL variables. and lets say i want to allow the potential-house-buyer to view each of the images of the current house. im using PHP to see how many images of the house there are *within a folder of only images of that house* and i provide a link for each one that, when clicked, loads the image in a small iframe. each and every URL i need to embed *whether it be php includes or images or whatever* must be called from the root directory bc each of the pages i setup are all variables called from the index page. that means even though the image to one of the houses would be current_folder/images/1.jpg must be called like so:
root/property/type_of_land/price/town/numeric_value_of_currently_viewed_house/images/1.jpg

if you are with me at this point .... i think i have my point. i know a database could receive calls and sort by each of the stupid folders i have created. i dont know enough about php really to make it more efficient though. i dont want to redo the entire site as i have it working great and i must also make it easy to edit by the company *they can just throw images in the folders and it knows how many image links to create and overwrites old property if they have already sold it*

is there anything i can do at this point that would be worthwhile to help me? i have just completed everythign and have it working. but i must go thru and create working pages for each and every property *15x7x4x3* before i can release it for them to edit. i know you may be thinking how stupid i am to take on a job like this. i have no problem comprehending the job, i just dont know how to increase my efficiency, they are wanting it asap, and hardcoding took less time than learning hwo to do it another way then putting it all together then explaining a different way of organization to them

any ideas ?!?!? :p god this is such a mess to get running, but its actually very well organized for them to edit. heres the multiflavored horrorific nightmareish layout:

Code:
residential
	49k
		latham
			1
			2
			3
			4
			5
			6
			7
			8
			9
			10
			11
			12
			13
			14
			15
		dresden
			1
			2
			3
			4
			5
			6
			7
			8
			9
			10
			11
			12
			13
			14
			15
		gleason
			1
			2
			3
			4
			5
			6
			7
			8
			9
			10
			11
			12
			13
			14
			15
		palmersville
			1
			2
			3
			4
			5
			6
			7
			8
			9
			10
			11
			12
			13
			14
			15
		sharon
			1
			2
			3
			4
			5
			6
			7
			8
			9
			10
			11
			12
			13
			14
			15
		martin
			1
			2
			3
			4
			5
			6
			7
			8
			9
			10
			11
			12
			13
			14
			15
		greenfield
			1
			2
			3
			4
			5
			6
			7
			8
			9
			10
			11
			12
			13
			14
			15
	50k
		latham
			1
			2
			3
			4
			5
			6
			7
			8
			9
			10
			11
			12
			13
			14
			15
		dresden
			1
			2
			3
			4
			5
			6
			7
			8
			9
			10
			11
			12
			13
			14
			15
		gleason
			1
			2
			3
			4
			5
			6
			7
			8
			9
			10
			11
			12
			13
			14
			15
		palmersville
			1
			2
			3
			4
			5
			6
			7
			8
			9
			10
			11
			12
			13
			14
			15
		sharon
			1
			2
			3
			4
			5
			6
			7
			8
			9
			10
			11
			12
			13
			14
			15
		martin
			1
			2
			3
			4
			5
			6
			7
			8
			9
			10
			11
			12
			13
			14
			15
		greenfield
			1
			2
			3
			4
			5
			6
			7
			8
			9
			10
			11
			12
			13
			14
			15
	75k
		latham
			1
			2
			3
			4
			5
			6
			7
			8
			9
			10
			11
			12
			13
			14
			15
		dresden
			1
			2
			3
			4
			5
			6
			7
			8
			9
			10
			11
			12
			13
			14
			15
		gleason
			1
			2
			3
			4
			5
			6
			7
			8
			9
			10
			11
			12
			13
			14
			15
		palmersville
			1
			2
			3
			4
			5
			6
			7
			8
			9
			10
			11
			12
			13
			14
			15
		sharon
			1
			2
			3
			4
			5
			6
			7
			8
			9
			10
			11
			12
			13
			14
			15
		martin
			1
			2
			3
			4
			5
			6
			7
			8
			9
			10
			11
			12
			13
			14
			15
		greenfield
			1
			2
			3
			4
			5
			6
			7
			8
			9
			10
			11
			12
			13
			14
			15
	100k
		latham
			1
			2
			3
			4
			5
			6
			7
			8
			9
			10
			11
			12
			13
			14
			15
		dresden
			1
			2
			3
			4
			5
			6
			7
			8
			9
			10
			11
			12
			13
			14
			15
		gleason
			1
			2
			3
			4
			5
			6
			7
			8
			9
			10
			11
			12
			13
			14
			15
		palmersville
			1
			2
			3
			4
			5
			6
			7
			8
			9
			10
			11
			12
			13
			14
			15
		sharon
			1
			2
			3
			4
			5
			6
			7
			8
			9
			10
			11
			12
			13
			14
			15
		martin
			1
			2
			3
			4
			5
			6
			7
			8
			9
			10
			11
			12
			13
			14
			15
		greenfield
			1
			2
			3
			4
			5
			6
			7
			8
			9
			10
			11
			12
			13
			14
			15

the scary thing is ... if this works well, i want to ask other realtors, only i wont use this method, i plan to know wtf im doing beforehand :p
 
Sweet Mother of Christ.... you are planning on _statically_ creating 1200+ pages to display each, and every, option available?!?!? I would _highly_ suggest using ANY sort of SQL backend to store the information relating to each option and the location of the corresponding images/data/whatever. This type of problem is _exactly_ what databases are meant to solve. Your PHP can be extremely efficient, but this design's inflexibility will bite you in the arse some day.

My suggestion:
Use MySQL/MSSQL/Oracle to create a database that will hold the information for each property and a set of stored procedures to provide that data to PHP in a sane manner. Disregard the tree structure. That structure is too unwieldy (as you have noticed) in code; leave that for the user interface.

I would also suggest ditching the limitations placed on the system. If you code for any number of properties, in any number of cities (ad nauseum), then you will have a more robust, flexible system that you _might_ offer to another client in the future. The fewer hardcoded variables or mental limitations you are enforcing, the better your code will be.

Once you have a working data store, you can begin pulling the data into your web application and performing operations on it. You could allow certain (or all) users to add new properties, edit existing properties and close listings. I would allow the data on closed properties to persist in the data store; it may be useful later, and disk space is cheap. Users may search listings, add photos, etc. All from a uniform interface that you could write in (X)HTML/CSS/PHP.

If you are having troubles with databases, perhaps you could consult a DBA you may know, or someone in an area LUG? Posting problems online works, though it is often less accurate, and may not yield the context specific results that local help can provide.
 
they have to be able to edit it themselves, pictures, content, everything. and since i had no knowledge i didnt have many options. even though its easy for them to drag and drop to update, i definately wont be using this method again.

i plan on using MySQL and PHP together. i have both bible books my boss ordered for me *mmm benefits* how much php should i know before trying to tackle using php with a database? any links in particular that have newbie tuts for PHP AND MySQL together. im assuming i wont need much PHP knowhow; it will mainly just be a database holding info to be displayed on the web in certain locations
 
Back
Top