i m developing one real estate site using php/mysql.when i search i get one page with type, state ,locality.i wanted another column as click here to view that details.
I want every detail page stored as a html document.
Basically i need a script that will read the entire database
and create one html doc for every listing.

If there are 100 entries in the DB i must have 100 html docs.i can name every enteries as listing id 1 or listing id 2 ext.

Every row in the search table will have a link to this details page
HTML doc.
how i must proceed to store details .
pls guide me. i m new to php

By the way, why you want html pages? Many search engine like google and yahoo is able to crawl dynamic site like daniweb. Plus, almost all browser support php page and php page will not reduce your page rank.

if i convert dyanmic pages to static
html, becomes faster.

There is no evident about static page will load faster than dynamic one. The loading speed is depend on the network capability of your server as well as the user's. Many dynamic site may load faster as the page using server-side include to call content from a number of small pages or from database. The page will load almost immediately when called although some content from SSI pages may not completey loaded yet. In contrast, static page need to hold all information you currently store in database and guess what. Your page load slower.

i agree with ur point .but not my client :D . so any body help me of good tutorial. or any body tell me how i should proceed

Hi aarya,

I posted a reply for you here http://www.daniweb.com/techtalkforums/thread32816.html on your last post.

However, it seems you want to get the data from your db.
What you would need to do is to gather each listing from the db. And use a function like the following to create the html pages.

// creates a local version of any url contents as html files
function cache_url($url, $cache_name, $cache_path = 'cache/') {

        // this is simple the path to store the html file
        $cache_abs_path = $cache_path.$cache_name;
        // this opens an http connection to the url of your webpage
        // search fopen at php.net
        // you must supply a http path to this, so that we use the http wrapper and return only html
        if (!$file = @fopen($url, 'r')) {
            echo ('could not open the url: '.$url);
            return false;
        // this opens a file pointer to the html file you are saving too
        // if the file doesnt exist, then it will attempt to create a new one
        // you need the directory to have write permissions for the script
        // chmod 777  (this can be done via ftp, or a web control panel, or php)
        if (!$cache_file = @fopen($cache_abs_path, 'w+')) {
            echo ('could not open the cache: '.$cache_abs_path.' for writing.');
            return false;

        // here we read the contents of the webpage
        while($read = fread($file, '2082')) {

            $content .= $read;
           // we write the content of our webpage to the html file
            if (!@fwrite($cache_file, $read)) {
            echo ('error writing to cache: '.$cache_file.' for writing.');
            return false;

Heres an example:

// if the script is in your webroot (http://mysite.com/) then the new page will be http://mysite.com/pages/page_43.html)

cache_url('http://mysite.com/page.php?id=43', 'page_43.html', 'pages');

what you will do is:

connect to db:
get page listing id=1
Then supply it to he function.

cache_url('http://mysite.com/page.php?id=1', 'page_1.html', 'pages');

I would however recommend using the title of the listing instead of id (as long as the titles are unique), since you are already going to the difficulty of creating the static pages, make it SEF.

good luck.
www.digital-ether.com ;)

ps: I didnt test the function, so there may be typos. It should be easy to figure out though if you use php.net as a reference to search each function.

hi thanks for ur reply. thsi would definetly help me
but i tried my self and i got what i wanted .i used fputs function to do this.