index.php?page=aboutme
April 26, 2002 by daynah
Filed under Code Snippets
I recieved an email yesterday about this:
Hi,
I visited your site daynah.net, very nice site you got :) I very curious how do you ppl extract data from a
database like ‘index.php?page=aboutme’. I read through php.net which some of them refer me and i don’t find very good page on the site to teach me on that. I currently have a database (mySQL) so i can try it out :) but i need some guide, im very new to it =)
Would you mind to guide me with how to extract data on the database and do a link like ‘index.php?page=aboutme’? I really very curious about it..heh.
Hope to hear from you soon,
Edward
—————
Hello there curious Edward. ;) A lot of people have been asking me this, so I decided to post it up to share . The coding is pretty simple. And this is only one way of doing it.
In your index.php page, put in this:
<?
if($page == 'aboutme')
include('aboutme.php');
else if($page == 'downloads')
include('downloads.php');
else
include('main.php');
?>
now create other files called aboutme.php, downloads.php, and main.php. And put something in them like “this is the about me page,” “this is the downloads page,” etc.
Go to your url, http://yourdomain.com/index.php?page=aboutme What do you see?
So.. is that simple? :) Another note, the pages don’t have to be aboutme.php… it can also be aboutme.txt of aboutme.html, or rename it to anything else if you like. And a mysql database is not required at all. I hope that helps.


@






