_php Tutorial for dynamic content display in PHP static pages

Source: Internet
Author: User
Recently, when you make a site, you need to generate static pages, but some of the generated static pages need to be dynamically obtained, how can not be generated every day it?
Finally on the Internet to check a bit, plus a to summarize, ah .... Finally realized. Sent, we study together. Oh...
Apply a: article count, get dynamic content
Count page: count.php
Copy CodeThe code is as follows:
Require_once './global.php ';
$DB->query ("Update". $tablepre. " Teacher set views=views+1 where id= ' ". $_get[' id ']." ' ");
$hello = $DB->fetch_one_array ("SELECT * from". $tablepre. " Teacher where id= ' ". $_get[' id ']." ' ");
$hcount = $hello [' views '];
?>
document.write (" ");

Add in static page mk.html

Remember: page path, generate static post-count file path will change.
Application Two: Get some dynamic information on this page, such as related articles
Similarly, links in static pages are still in this form
Copy CodeThe code is as follows:


The contents of the read.php are as follows:
Copy CodeThe code is as follows:
$cid =$_get[' CID '];
?>
document.write ("
















"); document.write (" "); document.write (" "); document.write (" "); document.write (" "); document.write (" "); $succquery = $DB->query ("SELECT * from". $tablepre. " Test where cid= ' $cid '); while ($SUCC = $DB->fetch_array ($succquery)) {?> document.write (" "); document.write (" "); document.write (" "); document.write (" "); document.write (" "); }?> document.write ("
Order numberGrade SubjectsTime
");
document.write ("
");

There is another way:
Static side:
Copy CodeThe code is as follows:





Dynamic page:

Fill in any thing this is dynamic without document.write ()


http://www.bkjia.com/PHPjc/320379.html www.bkjia.com true http://www.bkjia.com/PHPjc/320379.html techarticle recently, when you make a site, you need to generate static pages, but some of the generated static pages need to be dynamically obtained, how can not be generated every day it? Finally went online to check a ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.