Search
 
SCRIPT & CODE EXAMPLE
 

PHP

create Tables database in php

<?php
   $con=mysqli_connect("example.com","username","password","my_db");
   $sql="CREATE TABLE table1(Username CHAR(30),Password CHAR(30),Role CHAR(30))";
   if (mysqli_query($con,$sql)) {
      echo "Table have been created successfully";
   }
?>
Comment

Create a table with PHP in html

<?php
$inputfile = file("prod.txt");

$data_lines = array();
foreach ($inputfile as $line)
{
    $data_lines[] = explode(";", $line);
}

//Get column headers.
$first_line = array();
foreach ($data_lines[0] as $dl)
{
    $first_line[] = explode("=", $dl);
}
$headers = array();
foreach ($first_line as $fl)
{
    $headers[] = $fl[0];
}

// Get row content.
$data_cells = array();
for ($i = 0; $i < count($data_lines); $i++)
{
    $data_cell = array();
    for ($j = 0; $j < count($headers); $j++)
    {
        $data_cell[$j] = substr($data_lines[$i][$j], strpos($data_lines[$i][$j], "=")+1);
    }
    $data_cells[$i] = $data_cell;
    unset($data_cell);
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>HTML Table With PHP</title>
    </head>
    <body>
        <table border="1">
            <tr>
            <?php foreach ($headers as $header): ?>
                <th><?php echo $header; ?></th>
            <?php endforeach; ?>
            </tr>
        <?php foreach ($data_cells as $data_cell): ?>
            <tr>
            <?php for ($k = 0; $k < count($headers); $k++): ?>
                <td><?php echo $data_cell[$k]; ?></td>
            <?php endfor; ?>
            </tr>
        <?php endforeach; ?>
        </table>
    </body>
</html>
Comment

PREVIOUS NEXT
Code Example
Php :: mysql extension php enable 
Php :: softDelete laravel8 
Php :: php substr 
Php :: get redirect url for laravel socialite with api 
Php :: laravel request has 
Php :: showing custom post type in wordpress website 
Php :: laravel has many 
Php :: custom timestamp column laravel 
Php :: laravel blade fontawesome 
Php :: php array differ 
Php :: php try json decode and check 
Php :: $_get and $_post in php 
Php :: update checkbox value in laravel 
Php :: laravel check if api request 
Php :: livewire call function from other component 
Php :: Cambiar la imagen por defecto en producto WooCommerce 
Php :: group_concat mysql limit issue 
Php :: php Program for Sum of the digits of a given number 
Php :: Create Mysqli Table Using Php 
Php :: phpmyadmin drop database 
Php :: codeigniter validation text length 
Php :: what is array_map in php 
Php :: php authentication 
Php :: laravel copy 
Php :: laravel create many to many table 
Php :: pagination in codeigniter with example 
Php :: codeigniter sanitize input field 
Php :: attach function in laravel 
Php :: laravel pagination with search filter 
Php :: php date() 
ADD CONTENT
Topic
Content
Source link
Name
4+6 =