Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Will 12 into 1 go? 1

Status
Not open for further replies.

sinbadly

Technical User
Mar 16, 2006
126
GB
The php/mysql website has 12 monthly pages – Jan, Feb, Mar etc with 12 tables etc.

Is there a simple way to amalgamate the tables as one, and have one php webpage that brings up the appropriate month in response to the link clicked by the visitor, please, Experts?

So instead of having 12 separate php pages with 12 separate mysql queries, to have one of everything that provides the monthly page of the link that the visitor clicks.
 
Sure, it can be done. But it's impossible to say how easy it will be.


If your individual monthly pages have some kind of template that it fills in with data from MySQL, it will be easier to amalgamate.

If your individual monthly pages use similar MySQL queries, it will be easier.



Want the best answers? Ask the best questions! TANSTAAFL!
 
Yes to both points, sleipnir214.

I was thinking of if else/switch functions or the like, but for 12 that could be rather cumbersome, don't you think.

Many thanks for responding.
 
As a general rule, I find switch statements more readable than nested if-else statments. But again, that will depend on the structure of your code and the data in MySQL.

If I were designing something like this from scratch, I would make the code entirely data-driven, and have all the data organized so that I could pull it up using a single value, probably the number of the month. If your code can accept the month number on the URL:

[ignore][/ignore]

then you won't need any switches or if-elses at all.



Want the best answers? Ask the best questions! TANSTAAFL!
 
That sounds amazing, sleipnir214. I will have a think on it ... just sounds too simple, and see how it looks tonight. Very grateful for the brilliant idea. Cheers
paul
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top