How to get one webpage to display different content from db
Posted: Mon Mar 23, 2009 2:15 pm
Hi,
I am converting an existing website to php. I have created a backend that allows the website owner to add their page content to a mysql database or amend existing content. I also have working code that adds the code from the database into a web page.
The webpage is made up of 3 sections:
1. Header
2. Side menu
3. Main content area.
I have used the php 'include' statement to add the header and side menu bar to all my existing pages plus code to bring the text from the database into the main content area. But I think I have gone about this all wrong as I now have 10 php webpages and the only difference between them is the 'WHERE' clause in the sql statement (that brings in the main content).
Question:
Is it possible to get a value into a variable when a side menu item is clicked so that my sql statement is changed (and refresh the page/reload it) so that I only need one page instead of 10?
Thanks
I am converting an existing website to php. I have created a backend that allows the website owner to add their page content to a mysql database or amend existing content. I also have working code that adds the code from the database into a web page.
The webpage is made up of 3 sections:
1. Header
2. Side menu
3. Main content area.
I have used the php 'include' statement to add the header and side menu bar to all my existing pages plus code to bring the text from the database into the main content area. But I think I have gone about this all wrong as I now have 10 php webpages and the only difference between them is the 'WHERE' clause in the sql statement (that brings in the main content).
Question:
Is it possible to get a value into a variable when a side menu item is clicked so that my sql statement is changed (and refresh the page/reload it) so that I only need one page instead of 10?
Thanks