| Home | Register | FAQ | Members List | Search | Today's Posts | Mark Forums Read |
|
|
#1 (permalink) |
|
Registered User
Join Date: Nov 2007
Posts: 72
|
Database?
Hi i got a website but as i was creating it i found that i would have so many pages. Is there a possibilty to say have one real template and a database and depending on what you click on on the main page it will load the details from the database to website? and can anyone help thanks |
|
|
|
|
|
#2 (permalink) |
|
Spare Parts
Join Date: Jan 2005
Location: Bracknell Forest
Posts: 4,931
|
Like this? Create a page outputsql.php. Set it up to output from your database but use this code to create your sql query code. <?php if($search){$sql = "SELECT * from database where col1 LIKE '$search'";} else {$sql = "SELECT * from database";} ?> So the default is all comes out of the db. Now set up a page orange.php. Or any other call you want to make on the db. Then the first line of orange.php would be <?php $search="orange"; include("outputsql.php"); ?> |
|
|
|
#6 (permalink) |
|
Senior Member
Join Date: Jan 2005
Posts: 12,358
|
Forget databases for now. You can use Google's site search thing. Take one step at a time. Learn HTML and CSS. Then some JavaScript. Then start looking at programming and databases. I didn't learn a lick of PHP or MySQL until I had been doing HTML and CSS for 2 years. |
|
|
|
#7 (permalink) |
|
Registered User
Join Date: Nov 2007
Posts: 72
|
hmmm, cos right now let me show you how my site will be like. there is a home page: index.html then there are 26 pages, from a-z on the hom page now in each of those letter there are a number of other pages as well so i thought it would be easier to use a database and say have one main page and it pulls the data from somewhere |
|
|
|
#11 (permalink) |
|
Registered User
Join Date: Nov 2007
Posts: 72
|
hmmm is it simple to use? how exactly does it work the joomla? thanks I have a website right now for football team anthems. Now right now i have to create and edit a page for every team and as i add more teams it will take a lot of work, so thought there would be an easy way where i can have a template with variables and they all get replaced with the correct team etc. website is here: fervor.110mb.com thanks |
|
![]() |