Need help making database driven PHP site

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ghank
Forum Commoner
Posts: 35
Joined: Tue Apr 06, 2004 3:21 pm

Need help making database driven PHP site

Post by ghank »

Ok, I am fairly new to PHP. What I do know is how to setup mysql and fetch the info. I have php files which fetch various templates which fetch the data and that works great. But now I am working on a new project and need to make 50,000+ more webpages. Before I would make the pages by hand. They were simple, but this many pages would take too long. All of the page names are different also. So does anybody know of a tutorial or have any tips on how to house all of the data for the pages in mysql? So I wouldn't have an actual php page, but a link to it that would pull it from the DB and make the page. The search engines would also need to believe it was a real page to index. I am thinking I would need to put something in the Htaccess file to get it started but I am lost and haven't been able to find an answer. Or maybe I need to have a php file in order to do this? Thanks in advance...
User avatar
James M.
Forum Contributor
Posts: 119
Joined: Wed Mar 31, 2004 6:41 pm
Location: Tallahassee

Post by James M. »

You could pass data with links doin somthing like this:

<a href="page.php?data=something&data2=somethingelse">Link</a>

and that link would pass the variables $data and $data2 holding the values "something" and "somethingelse", respectively, to a page/ function (in your case it seems like a function).

well thats the way ive done it before and ive had no problems with it, but there could be a better way, im kind of new to php myself. Using the php function urlencode() helps in makin the links too.

http://us2.php.net/manual/en/function.urlencode.php
ghank
Forum Commoner
Posts: 35
Joined: Tue Apr 06, 2004 3:21 pm

Post by ghank »

Interesting! But doesn't the link look funky to the search engines? I need the pages to have my keywords in them and nothing else. My main goal is to get these pages to the top of the search engines with the minimal amount of effort. Yah, I am lazy, but why do more than you need to. This way I can spit out more pages and have more exposure.
User avatar
James M.
Forum Contributor
Posts: 119
Joined: Wed Mar 31, 2004 6:41 pm
Location: Tallahassee

Post by James M. »

well u could make a form where with the name $search an in the MySQL query use a regular expression(REGEXP) to search the DB for what your looking for like this:

SELECT $row FROM $db WHERE $row REGEXP '$search'

im not sure about that REGEXP statement, im new at it but it looks like you'll need REGEXP. If you want to learn about it go to http://dev.mysql.com/doc/mysql/en/Regexp.html
ghank
Forum Commoner
Posts: 35
Joined: Tue Apr 06, 2004 3:21 pm

Post by ghank »

Thanks James, I'll look into it.
Post Reply