create a table with php in html

Solutions on MaxInterview for create a table with php in html by the best coders in the world

showing results for - "create a table with php in html"
Abree
22 Feb 2020
1<?php
2$inputfile = file("prod.txt");
3
4$data_lines = array();
5foreach ($inputfile as $line)
6{
7    $data_lines[] = explode(";", $line);
8}
9
10//Get column headers.
11$first_line = array();
12foreach ($data_lines[0] as $dl)
13{
14    $first_line[] = explode("=", $dl);
15}
16$headers = array();
17foreach ($first_line as $fl)
18{
19    $headers[] = $fl[0];
20}
21
22// Get row content.
23$data_cells = array();
24for ($i = 0; $i < count($data_lines); $i++)
25{
26    $data_cell = array();
27    for ($j = 0; $j < count($headers); $j++)
28    {
29        $data_cell[$j] = substr($data_lines[$i][$j], strpos($data_lines[$i][$j], "=")+1);
30    }
31    $data_cells[$i] = $data_cell;
32    unset($data_cell);
33}
34?>
35<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
36<html>
37    <head>
38        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
39        <title>HTML Table With PHP</title>
40    </head>
41    <body>
42        <table border="1">
43            <tr>
44            <?php foreach ($headers as $header): ?>
45                <th><?php echo $header; ?></th>
46            <?php endforeach; ?>
47            </tr>
48        <?php foreach ($data_cells as $data_cell): ?>
49            <tr>
50            <?php for ($k = 0; $k < count($headers); $k++): ?>
51                <td><?php echo $data_cell[$k]; ?></td>
52            <?php endfor; ?>
53            </tr>
54        <?php endforeach; ?>
55        </table>
56    </body>
57</html>
58
queries leading to this page
html and php tablecreate a simple table in mysql through php code create table in cli phpphp create table from mysql resultphp generate html tablephp creating table examplephp 24table 3d new html table 28 29 3bphp create html table from databasecreate table in sql with phphow to create table in db by phphow to make tables in phpcreate table sql using phpwriting table html inside phphow to create table in phpcreate table in database phpphp creating a table codemake a table in your database phpphp create table in command linecreate table php codephp how to make html tablehow to make a table sql with phpcreating a table in phphtml table in phpphp code to create tablecreate table from function phpcreate table in sql phpcreate database table from phphoe to make table in phpcreate table sql in phpphp create html table functionphp table htmlphp script to create table in mysqlphp table to create tablecreate database table in phphow to create a table in phpcreate html table using phphow to crate a table in php how to make table in phpcreate a table in php using htmltable html with phpphp create table htmlmake table from html data in phphow do create a table in phpcreate table phpcreate table in phpphp creating html tablephp code with html tablehtml table with phpcreate a table with php in htmlcreate html table row phphow to create a table in php using htmlcreate table using phpcreate tables in sql with phpphp create html tablehow to create table using phphow to make html table that uses phphow to create a table from phptable in html and phpphp create table on sqlhow to create a table in html using phphtml table in php codehow to make php data to tableshow to create a table using phpcreate a table with php in html