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? ------ Solution ---------------------- B. php: $ conmysqli_connect (localhost, root, root, te php background to find data, output in html table, how to do
The php background detects the data and outputs it in the html table. Background B .php and foreground a.html. The detected data is $ result, which contains id and name. How?
------ Solution ----------------------
B. php:


$ Con = mysqli_connect ('localhost', 'root', 'root', 'test'); // modify the user name and password.
$ 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']}
';
File_put_contents('a.html ', $ html );


------ Solution ----------------------
Use Template technology

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.