generating mass pages



after getting better with PHP and MYSQL i want to see how to generate lots of product pages using PHP. for instance as an example if i create a database for all the products in a shop (e.g. the name, price description...etc) if i design a template page how do i get the products to have their own individual pages using the template page? what i am asking is how do i create mass pages?

i havent a clue so any help would be great! :help:
It's as simple of just quering the database for only one record instead of making a list.

url would be something like
$query = 'SELECT * FROM table WHERE id="'.mysql_real_escape_string($_GET['id']).'" LIMIT 1'; 
//query to grab only one result after it finds the id
//see for more info on it's functionality

$result = mysql_query($query); //queries the db and gets results
if(mysql_num_rows($result)){ //checks to see if any results were found
    $row = mysql_fetch_assoc($result);  //grabs an associative array from the result. 
    //since it got here and we specified LIMIT 1 we know there is only going to be one result
    echo 'Product Name: '.$row['name'].'<br />Price: '.$row['price'].'<br />Description: '.$row['description'];  
   //displays prod info
    echo 'Product Not Found'; //if no result this will display

let me know if you have questions
what you can do is ...

and then using mod_rewrite

to map the above url to...

I think that is what you are really requiring
thanks for the quick replies, they are the main reason i keep coming back to either answer or ask questions, i will try the first method to see how much time it saves me (i predict a lot) if i can get it to work the way i want to it will be a life saver!

thanks a lot guys!
or..if you will explain a bit betteR, with more details: we will tell you even more ways of doing it or tweaking your code :)
i have a database for my friends kiting shop. it contains prices...etc. If you go to quite a few larger websites they use the same page layout for all their stock and they have thousands of pages, and your not telling me that PHP cannot generate those pages. The websites i have found use aspx which i know nothing about - im learning PHP as it is! So there you have it - thats what i am aiming to do.
Hehe... dont worry, be happy!

I have built 2 such webshops in PHP and soon going to build one more... and my CMS is using almost the same way of genereating pages..

Ofcource its possible.. (by the way .aspx asmx and so on are pages -- you will have to know C# or VB to use it and i really dont like it -- love C# thou..)

So yes.. you can... and Redcircles way is basicly how you will need to do it :)
I would use a template angine, a very basic one atleast and that would work fine: you will simply need to change information in that tempalte.. its best to simply output some variables in that template and those variables will contain all the information you want to do..

Note on is a very powerfull language... its actually the simples language to write webservices in that willh ave to work with windows application, as in most cases you will write both Windows application and that webservice. And therefore you use the same language for writing both... its very practical... BUT. Asp and (2 different languages by the way) cant do anything that PHP cant. And lots of things are much more complicated in then in PHP..

Note to Redcircle:
It would be nice if when you post your PHP code you start and end it with PHP tags: as you can see, after i have added those to your code: it became syntax highlighted. I did not put the function that will automatically add those if they are not existent as not everyone posts PHP code and, unfortunatelly -- php does not hightlight all the text passed to it, but only the one between php tags. Thanx in advance, mate :)
can i be a pain? is it possible to turn these parts
into something like

$name = '.$row['name'].'
is that code i have
used possible or wrong? the reason being is that i can input the value $name into HTML documents easily in the form <? $name; ?>.

okej... do this: $name = $row['name'];
but you will have to do an output in a loop as otherwise your values will be overwriten...

u may output like this as well <?=$name?>
Thanks! i got it to work using:

$price = ''.$row['price'].'';

but your way is much easier. Can i simply ask how do you get HTML markup in PHP sets of code? I have tried the ' but i always get errors!!!

i meant how do you insert HTML tages such as <BR> into PHP coding e.g.

echo $name </ br>

will not work. I have tried all sorts but to no avail. is this any better explained?
Actually what i do is most of the time working with templates and php does not contain any html tags.. but in some cases its needed... therefore im doing this:

$text = "Some text here".$var."<br />Some more text ont he <b>next</b> line";