How can I find data in the php background and output it in an html table?

Source: Internet
Author: User
The php background detects the data and outputs it in the html table. how does the php background find the data and output it in the html table. Background B .php and foreground a.html. The detected data is $ result, which contains id and name. How?


Reply to discussion (solution)

Online and other online

B. php:

$ Con = mysqli_connect ('localhost', 'root', 'root', 'test'); // modify the username and password by yourself. $ a = mysqli_query ($ con, 'select * from A'); // modify the table name by yourself $ html ="
 "; While ($ rel = mysqli_fetch_assoc ($ a) {$ html = $ html ."
   ";} $ Html .'
  
Id Name
{$ Rel ['id']} {$ Rel ['name']}
'Your file_put_contents('a.html ', $ html );

B. php:

$ Con = mysqli_connect ('localhost', 'root', 'root', 'test'); // modify the username and password by yourself. $ a = mysqli_query ($ con, 'select * from A'); // modify the table name by yourself $ html ="
 "; While ($ rel = mysqli_fetch_assoc ($ a) {$ html = $ html ."
   ";} $ Html .'
  
Id Name
{$ Rel ['id']} {$ Rel ['name']}
'Your file_put_contents('a.html ', $ html );


This is output in the PHP file. I want to output it to other html pages.

So you have to clarify your needs?

So you have to clarify your needs?


Simple, basic functions. For example, a.php and a.html. PHP queries the information and outputs it to the.html page.

Use Template technology

Use Template technology


Smarty won't be used. it's hard. The boss won't use thinkphp, so he can write it directly like this.

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.