Old 05-04-2007, 05:09   #1 (permalink)
Petronella
Registered User
 
Join Date: Jul 2006
Posts: 7
Automatic page setup with PHP

I'm working on a website that eventually will have thousands of pages. Usually the sites I make are a lot smaller than that, and I design all the pages individually. However, for this job that is obviously not an option.

I know that you can do this somehow in PHP, for example, you see this a lot: index.php?page_id=xx

Can someone explain to me how exactly this works? I know only a tiny bit PHP, but I'm sure I can figure it out, I just don't know where to start.

Thanks.
  Reply With Quote
Old 05-04-2007, 07:45   #2 (permalink)
Cborrow
I like code.
 
Join Date: Dec 2004
Location: Chesapeake, VA
Posts: 215
Send a message via AIM to Cborrow
Well the index.php?page_id=xx is a Get request. You access that like this.

Code:
<?php $page = $_GET['page_id']; ?>

and you would use that to access a Database or the like to call your sites content

Code:
<?php $page = $_GET['page_id']; $r = mysql_query("SELECT title,content FROM pages WHERE id = '$page'"); while($rows = mysql_fetch_array($r)) { //Display your content } ?>

That is a small simple example as to what you would need to do. Check out theses sites/books for more info.

PHP MySQL Tutorial
PHP/MySQL Tutorial
Build your own Database Driven Website using PHP & MySQL - Third Edition [PHP & MySQL Tutorials]

And if you still need to learn the basics of PHP

4WebHelp - PHP Basics
PHP Basics -- Introduction

Also PHP's site has a wealth of knowledge in the documentation and there comments

PHP: Hypertext Preprocessor
  Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Contact Us - Web Design Forums - Archive - Top
Search Engine Optimization by vBSEO 3.0.0 RC8