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 ="
Id |
Name |
"; While ($ rel = mysqli_fetch_assoc ($ a) {$ html = $ html ."
{$ Rel ['id']} |
{$ Rel ['name']} |
";} $ Html .'
';
File_put_contents('a.html ', $ html );
------ Solution ----------------------
Use Template technology