Is there a way to wrap the text within the database?
I have a address being added into the database under the address column, but whenever I try to output the database through PHP it shows that the address column is seriously long which goes all the way out of the range of the paper size. Is there a method I could wrap these text into a specific amount of letters and have it line break on the output file or within the database?
edit: updated question with code
CODE:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
</head>
<body><!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>UGGL PEUI Customer Dividend - 12-01-2014</title>
<style type="text/css">
body,td,th {
font-family: Lato, Calibri, Arial, sans-serif;
font-style: normal;
font-weight: normal;
font-size: 12px;
}
body {
background: #C28E33;
color: #E6FFF2;
}
table{
border: 0px solid black;
border-spacing: 0px;
}
table thead tr{
font-family: Arial, monospace;
font-size: 14px;
}
table thead tr th{
border-bottom: 2px solid black;
border-top: 1px solid black;
margin: 0px;
padding: 2px;
background-color: #cccccc;
font-weight:bold
}
table tr {
font-family: arial, monospace;
color: black;
font-size:12px;
background-color: white;
}
table tr.odd {
background-color: #AAAAAA;
}
table tr td, th{
border-bottom: 1px solid black;
padding: 2px;
}
a:link{
font-family:arial, monospace;
text-decoration: none;
color: teal;
}
a:hover{
text-decoration: underline;
}
a:visited{
color:black;
text-decoration: none;
}
</style>
</head>
<body>
<?php
// HTML Table Output
echo
"<table border='1'>
<thead>
<tr>
<th>ID</th>
<th>Purchase Date</th>
<th>Mature Date</th>
<th>Amount</th>
<th>Beneficiary First Name</th>
<th>Beneficiary Last Name</th>
<th>Beneficiary ID</th>
<th>Beneficiary Contact No.</th>
<th>Beneficiary Address</th>
<th>Bank Account Name</th>
<th>Bank Account No.</th>
<th>Bank Swift Code</th>
<th>Bank Name</th>
<th>Bank Address</th>
<th>Bank Contact No.</th>
<th>Agent Name</th>
<th>Dec. 1, 2014 (Days)</th>
<th>Dec. 1, 2014 (Dividend)</th>
</thead>
</tr>";
while($row = mysqli_fetch_array($result)) {
echo "<tr>";
echo "<td>" . $row['id'] . "</td>";
echo "<td>" . $row['purchase_date'] . "</td>";
echo "<td>" . $row['mature_date'] . "</td>";
echo "<td>" . $row['unit'] . "</td>";
echo "<td>" . $row['beneficiary_first'] . "</td>";
echo "<td>" . $row['beneficiary_last'] . "</td>";
echo "<td>" . $row['beneficiary_id'] . "</td>";
echo "<td>" . $row['beneficiary_no'] . "</td>";
echo "<td>" . $row['beneficiary_add'] . "</td>";
echo "<td>" . $row['bank_acc_name'] . "</td>";
echo "<td>" . $row['bank_acc_no'] . "</td>";
echo "<td>" . $row['bank_swift'] . "</td>";
echo "<td>" . $row['bank_name'] . "</td>";
echo "<td>" . $row['bank_add'] . "</td>";
echo "<td>" . $row['bank_no'] . "</td>";
echo "<td>" . $row['agent'] . "</td>";
echo "<td>" . $row['first_days'] . "</td>";
echo "<td bgcolor=#E6FFF2><b>" . $row['first_payment'] . "</b></td>";
echo "</tr>";
}
echo "</table>";
// Close MySQL
mysqli_close($con);
?>
</body>
</html>
You can use two CSS properties:
<style>
.your-element{
word-wrap:break-word;
word-break:break-all;
}
</style>
Demo
References:
Word Wrap
Word Break
Related
**Hi, I want to make a one-page website that can filter the data between two dates. I am new to coding and can someone teach me how to do it? I have no idea how to do it, and below is my code. I want to do a web page that can be selecting data between two dates. please help me. I tried to use an example from a website but I still can not make it **
<!DOCTYPE html>
<html lang="en" >
<head>
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<style>
#customers {
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
border-collapse: collapse;
width: 100%;
}
#customers td, #customers th {
border: 1px solid #ddd;
padding: 8px;
}
#customers tr:nth-child(even){background-color: #f2f2f2;}
#customers tr:nth-child(odd){background-color: #f2f2f2;}
#customers tr:hover {background-color: #ddd;}
#customers th {
padding-top: 12px;
padding-bottom: 12px;
text-align: left;
background-color: #4CAF50;
color: white;
}
.block {
display: block;
width: 100%;
border: none;
background-color: #4CAF50;
color: white;
padding: 14px 28px;
font-size: 16px;
cursor: pointer;
text-align: center;
}
.block:hover {
background-color: #ddd;
color: black;
}
</style>
<meta charset="UTF-8">
<title>Feedback</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.8.3/modernizr.min.js" type="text/javascript"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css">
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<form action = "#" method="POST">
<div class="w3-show-inline-block">
<div class="w3-bar">
<center>
<input type="submit" value="Download as PDF" name="logout" class="w3-btn w3-black">
</center>
</div>
</div>
</form>
<form action = "logout.php" method="POST">
<div class="w3-show-inline-block">
<div class="w3-bar">
<center>
<input type="submit" value="LogOut" name="logout" class="w3-btn w3-black">
</center>
</div>
</div>
</form>
<?php
session_start();
require 'config.php';
if (isset($_SESSION['login_user'])) {
$userLoggedIn = $_SESSION['login_user'];
$result = mysqli_query($con,"SELECT * FROM poll");
echo "<table border='1' id='customers'>
<tr>
<th>Name</th>
<th>Email</th>
<th>Phone</th>
<th>feedback</th>
<th>feedback1</th>
<th>feedback2</th>
<th>Suggestions</th>
</tr>";
while($row = mysqli_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['name'] . "</td>";
echo "<td>" . $row['email'] . "</td>";
echo "<td>" . $row['phone'] . "</td>";
echo "<td>" . $row['feedback'] . "</td>";
echo "<td>" . $row['feedback1'] . "</td>";
echo "<td>" . $row['feedback2'] . "</td>";
echo "<td>" . $row['suggestions'] . "</td>";
echo "</tr>";
}
echo "</table>";
}
else {
//header("Location: index.php");
}
?>
<script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
</body>
</html>
With the php script below I read user-records of my sql database and show them in my webpage. However, there is an unwanted empty space between the records. How can I remove this empty space?
Sorry, the items are in Dutch language.
<style>
table {
border-collapse: collapse;
border: 1px solid lightblue;
text-align: left;
font-family: verdana;
font-size: 11px;
}
th,td {
border: 1px solid lightblue;
cell-padding: 0px;
}
table.a {
table-layout: fixed;
width: 350px;
background-color: lightblue;
font-weight: bold;
font-size: 13px;
}
table.b {
table-layout: fixed;
width: 350px;
}
table.c {
width: 80px;
margin-left: 355px;
top: -105px;
position: relative;
}
</style>
foreach ($pdo->query($sql) as $row) {
echo "<table class=a><tr>" .
"<td>" . $row['achternaam'] . "</td>" .
"<td>" . $row['tussenvgsl'] . "</td>" .
"<td>" . $row['voornaam'] . "</td>" .
"<td>" . $row['stem'] . "</td>" .
"</tr></table>";
echo "<table class=b><tr><td>" .
$row['straat'] . "</td><td>" . "</td></tr></table>";
echo "<table class=b><tr><td>" .
$row['woonplaats'] . "</td><td>" .
$row['postcode'] . "</td></tr></table>";
echo "<table class=b><tr><td>" .
"Tel: " . $row['telefoon'] . "</td></tr></table>";
echo "<table class=b><tr><td>" .
"Email: " . $row['email'] . "</td></tr></table>";
echo "<table class=b><tr><td>" .
"Geb. datum: " . date('d-m-Y',($row['geboortedatum'])) . "</td><td>" .
"Inschrijfdatum: " . date('d-m-Y',($row['inschrijfdatum'])) . "</td></table>" ;
echo "<table class=c><tr>" .
"<td >" . "<img src='".$row['foto']." ' width=80 >" . "</td>" .
"</tr></table>";```
The empty space is because of the position: relative; declared in table.c. You can try to declare like this:
`table.c {
width: 80px;
margin-left: 355px;
top: 10px;
position: absolute;
}`
This should remove the empty space.
I am wondering if I can get my PHP page running because I try to load image files from the database in phpMyAdmin and on MySQL. Here is the line of code I was working on:
CREATE DATABASE WORLD;
use WORLD;
CREATE TABLE COUNTRY (
country_Order INT AUTO_INCREMENT NOT NULL,
continent_Name VARCHAR(225),
country_Name VARCHAR(225),
img BLOB,
country_Region VARCHAR(225),
country_Population INT,
country_Info VARCHAR(225),
PRIMARY KEY (country_Order)
) ENGINE=INNODB;
INSERT INTO COUNTRY (country_Order, continent_Name, country_Name, img, country_Region, country_Population, country_Info)
VALUES (1, "Asia", "Afghanistan", LOAD_FILE('\Users\sammyabdulkader\desktop\World-Data\img\Afghanistan.png'), "Central Asia", 38928346,"Afghanistan is a country located in Central Asia. It is a mountainous landlocked country.");
I want manually insert my own images that why from my folder path. This is being done on my MacBook Pro. Here is my PHP code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN">
<html>
<body>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>World Database</title>
<style type="text/css">
h1 {
color: #42963d;
font-family: 'Open Sans', sans-serif;
font-size: 34px;
font-weight: 300;
line-height: 40px;
margin: 0 0 16px;
text-align: center;
}
h2 {
font-family: 'Open Sans', sans-serif;
font-weight: 300;
text-align: center;
color: #50d248;
}
p.footer {text-align: center}
table.output {font-family: Ariel, sans-serif}
table {
border-collapse: collapse;
width: 100%;
color: #4ee44e;
font-family: monospace;
font-size: 25px;
text-align: center;
}
th {
background-color: #0b7208;
color: white;
}
tr:nth-last-child(even) {background-origin: #f2f2f2}
hr {
height: 12px;
border: 0;
box-shadow: inset 0 12px 12px -12px rgba(0, 0, 0, 0.5);
}
a {
color: red;
font-family: helvetica;
text-decoration: none;
text-transform: uppercase;
}
a:hover {
text-decoration: underline;
}
a:active {
color: black;
}
a:visited {
color: purple;
}
</style>
</head>
<body>
<?php
// Get connection
//$Conn = odbc_connect('database name','database user','database user & password');
$Conn = odbc_connect('WORLD', 'WORLD-User', 'WORLD-User+password');
// Test connection
if (!$Conn)
{
exit("ODBC Connection Failed: " . $Conn);
}
// Create SQL statement
$SQL = "SELECT * FROM COUNTRY";
$RecordSet = odbc_exec($Conn, $SQL);
// Test existence of recordset
if (!$RecordSet)
{
exit("SQL Statement Error: " . $SQL);
}
?>
<!-- Page Headers -->
<h1>List of countries from around the global.</h1>
<hr />
<h2>All Country's Alphabetical Order</h2>
<?php
// Table headers
echo "<table class='output' border='1'>
<tr>
<th>Country Order</th>
<th>Continent Name</th>
<th>country Name</th>
<th>Country Flag</th>
<th>Continent Region</th>
<th>Country Population</th>
<th>Country Info</th>
</tr>";
// Table data
while ($RecordSetRow = odbc_fetch_array($RecordSet))
{
echo "<tr>";
echo "<td>" . $RecordSetRow['country_Order'] . "</td>";
echo "<td>" . $RecordSetRow['continent_Name'] . "</td>";
echo "<td>" . $RecordSetRow['country_Name'] . "</td>";
echo "<td>" . $RecordSetRow['img'] . "</td>";
echo "<td>" . $RecordSetRow['country_Region'] . "</td>";
echo "<td>" . $RecordSetRow['country_Population'] . "</td>";
echo "<td>" . $RecordSetRow['country_Info'] . "</td>";
echo "</tr>";
}
echo "</table>";
// Close connection
odbc_close($Conn);
?>
<br />
<hr />
<p class="footer">Return to World Data</p>
<hr />
</body>
</html>
My problem is that when I did the manual way, I get null values for my PHP table.
The other problem is doing it on phpMyAdmin makes it look worse. Instead, it returns stranges characters.
Is there a possible way to fix my problem so that I can get my images in my database table up and running?
phpMyAdmin way inserting the images from the online database
Manual way from MySQL insert
This is just an example approach on how to do it.
The idea is to create a unique filename for each image. A simple fast way is a MD5 hash. Then we check if the file is there, and if not we create it. This caching improves performance on reload and image does not need to be created again.
With the use of IMG tag we just display the (newly created) file.
Note: You may need to style it with CSS and place the images into a directory for better organization.
while ($RecordSetRow = odbc_fetch_array($RecordSet))
{
$filename = md5($RecordSetRow['img']) . '.png';
if(!file_exists($filename)) {
file_put_contents($filename, $RecordSetRow['img']);
}
echo "<tr>";
echo "<td>" . $RecordSetRow['country_Order'] . "</td>";
echo "<td>" . $RecordSetRow['continent_Name'] . "</td>";
echo "<td>" . $RecordSetRow['country_Name'] . "</td>";
// Use HTML image tag with that file
echo "<td><img src='{$filename}' alt=''></td>";
echo "<td>" . $RecordSetRow['country_Region'] . "</td>";
echo "<td>" . $RecordSetRow['country_Population'] . "</td>";
echo "<td>" . $RecordSetRow['country_Info'] . "</td>";
echo "</tr>";
}
echo "</table>";
I'm trying to apply color on alternate lines in the following code in PHP, but I already tried in various shapes and examples here in the forum and it did not solve. I need only leave one white line, and another gray, filling in according to the mysql query. I would like to make this list without using CSS. Can someone help?
<style type="text/css">
.whiteBackground { background-color: #fff; }
.grayBackground { background-color: #ccc; }
</style>
<table class="table-bordered" style="text-align: center; margin-left: -50px; font-family: Verdana, Geneva, sans-serif; margin-top: 20px;" border="0" cellspacing="1" cellpadding="2" align="center">
<table class="table-bordered" style="text-align: center; margin-left: -50px; font-family: Verdana, Geneva, sans-serif; margin-top: 20px;" border="0" cellspacing="1" cellpadding="2" align="center">
<thead>
<tr>
<th style="font-size: 1em; padding: 5px;">Client</th>
<th style="font-size: 1em; padding: 5px;">Tech</th>
<th style="font-size: 1em; padding: 5px;">Status</th>
<th style="font-size: 1em; padding: 5px;">Data</th>
<th style="font-size: 1em; padding: 5px;">Start</th>
<th style="font-size: 1em; padding: 5px;">End</th>
<th style="font-size: 1em; padding: 5px;">Total Hours</th>
</tr>
</thead>
<tbody>
<?php
$x++;
$class = ($x%2 == 0)? 'whiteBackground': 'graybackground';
echo "<tr class='$class'>";
foreach ($os as $c) {
$query = "SELECT nome from users where idUsers=$c->users_id";
$data= $this->db->query($query)->result();
echo '<tr >';
echo '<td >' . $c->nameclient . '</td>';
echo '<td >' . $data[0]->name . '</td>';
echo '<td >' . $c->status . '</td>';
echo '<td >' . date('d/m/Y', strtotime($c->startDate)) . '</td>';
echo '<td >' . $c->startTime . '</td>';
echo '<td >' . $c->endTime . '</td>';
$time_diff = strtotime($c->endTime) - strtotime($c->startTime);
$var= $time_diff/60;
echo '<td >'.date('H:i', mktime(0,$var)).'</td>';
echo '</tr>';
}
?>
I'll show the example of using % (or Mod) to alternate the background color on a simple array.
$arr = array("fred","tim","bob","jimmy");
echo "<table>";
$i=1;
foreach ($arr as $row) {
$class = ($i % 2) ? " odd": " even"; //even or odd?
echo "<tr class=" . $class . ">";
echo "<td>" . $row . "</td>";
echo "</tr>";
$i++;
}
echo "</table>"
?>
<style type="text/css">
.even, .odd {
color:white;
}
.even {
background-color: blue;
}
.odd {
background-color: red;
}
</style>
And, how to do it in purely CSS. (IE 9 or greater: https://www.w3schools.com/cssref/sel_nth-child.asp)
$arr = array("fred","tim","bob","jimmy");
echo "<table>";
$i=1;
foreach ($arr as $row) {
echo "<tr>";
echo "<td>" . $row . "</td>";
echo "</tr>";
$i++;
}
echo "</table>"
?>
<style type="text/css">
.even, .odd {
color:white;
}
table tr:nth-child(even) {
background-color: blue;
}
table tr:nth-child(odd) {
background-color: red;
}
</style>
Just change your css to this
<style type="text/css">
/* .whiteBackground { background-color: #fff; } */
/* .grayBackground { background-color: #ccc; } */
tbody tr:even{background-color:#fff;}
tbody tr:odd{background-color:#ccc;}
</style>
I dont think many people use the HTML attribut bgcolor anymore, but you can use it in the TR tag bgcolor="#cccccc". Or you can just use an inline style of background-color: #cccccc;
$highlight = false;
foreach ($os as $c)
{
$query = "SELECT nome from users where idUsers=$c->users_id";
$data= $this->db->query($query)->result();
$time_diff = strtotime($c->endTime) - strtotime($c->startTime);
$var= $time_diff/60;
$highlight = !$highlight;
echo '
<tr '.($highlight ? 'bgcolor="#cccccc"' : '').'>
<td >' . $c->nameclient . '</td>
<td >' . $data[0]->name . '</td>
<td >' . $c->status . '</td>
<td >' . date('d/m/Y', strtotime($c->startDate)) . '</td>
<td >' . $c->startTime . '</td>
<td >' . $c->endTime . '</td>
<td >'.date('H:i', mktime(0,$var)).'</td>
</tr>';
}
I am new to programming, I have managed to create a page which fetches the data from MySQL.
I have used a jQuery plugin to freeze the first column and first row of my table.
The problem I am facing is, when I try to increase the width of a specific column it is not working.
Please help me to understand how do I increase width for specific column. This is my PHP and CSS for your reference.
Thanks.
PHP
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<title>Region Wise</title>
<link href="css/test.css" rel="stylesheet" media="screen" />
<header class="header">
<div class="titulosHeader">
<h2>Region Wise</h2>
</header>
</head>
<main class="main">
<div class="ContenedorTabla">
<?php
$sql = 'SELECT * from rgn_report';
$result = mysqli_query($con,$sql);
echo "<table id='pruebatabla' class='fht-table hoverTable'>
<thead>
<tr>
<th class='celda_encabezado_general' rowspan='3' style='height:100px;'>REGION</th>
<tr>
<th class='celda_encabezado_general' colspan='4'>KA</th>
<th class='space'></th>
<th class='celda_encabezado_general' colspan='4'>MI</th>
<th class='space'></th>
<th class='celda_encabezado_general' colspan='4'>OT</th>
<th class='space'></th>
<th class='celda_encabezado_general' colspan='4'>FA</th>
<th class='space'></th>
<th class='celda_encabezado_general' colspan='4'>HA</th>
</tr>
<tr>
<th class='celda_encabezado_general'>SOH</th>
<th class='celda_encabezado_general'>CY</th>
<th class='celda_encabezado_general'>CT</th>
<th class='celda_encabezado_general'>WC</th>
<th class='space'></th>
<th class='celda_encabezado_general'>SOH</th>
<th class='celda_encabezado_general'>CY</th>
<th class='celda_encabezado_general'>CT</th>
<th class='celda_encabezado_general'>WC</th>
<th class='space'></th>
<th class='celda_encabezado_general'>SOH</th>
<th class='celda_encabezado_general'>CY</th>
<th class='celda_encabezado_general'>CT</th>
<th class='celda_encabezado_general'>WC</th>
<th class='space'></th>
<th class='celda_encabezado_general'>SOH</th>
<th class='celda_encabezado_general'>CY</th>
<th class='celda_encabezado_general'>CT</th>
<th class='celda_encabezado_general'>WC</th>
<th class='space'></th>
<th class='celda_encabezado_general'>SOH</th>
<th class='celda_encabezado_general'>CY</th>
<th class='celda_encabezado_general'>CT</th>
<th class='celda_encabezado_general'>WC</th>
</tr>
</thead>";
echo "<tbody>";
while ($row = mysqli_fetch_array($result))
{
$rowhighlight = array("RGN1","RGN2","Grand Total");
if (in_array($row['rgn'],$rowhighlight)){
echo "<tr>";
echo "<td class='highlight_cell'>" . $row['rgn']."</td>";
echo "<td class='highlight_cell'>" . number_format($row['KA_SOH'])."</td>";
echo "<td class='highlight_cell'>" . number_format($row['KA_CY'])."</td>";
echo "<td class='highlight_cell'>" . number_format($row['KA_CT'])."</td>";
echo "<td class='highlight_cell'>" . $row['KA_CVR']."</td>";
echo "<td class='space'></td>";
echo "<td class='highlight_cell'>" . number_format($row['MI_SOH'])."</td>";
echo "<td class='highlight_cell'>" . number_format($row['MI_CY'])."</td>";
echo "<td class='highlight_cell'>" . number_format($row['MI_CT'])."</td>";
echo "<td class='highlight_cell'>" . $row['MI_CVR']."</td>";
echo "<td class='space'></td>";
echo "<td class='highlight_cell'>" . number_format($row['OT_SOH'])."</td>";
echo "<td class='highlight_cell'>" . number_format($row['OT_CY'])."</td>";
echo "<td class='highlight_cell'>" . number_format($row['OT_CT'])."</td>";
echo "<td class='highlight_cell'>" . $row['OT_CVR']."</td>";
echo "<td class='space'></td>";
echo "<td class='highlight_cell'>" . number_format($row['FA_SOH'])."</td>";
echo "<td class='highlight_cell'>" . number_format($row['FA_CY'])."</td>";
echo "<td class='highlight_cell'>" . number_format($row['FA_CT'])."</td>";
echo "<td class='highlight_cell'>" . $row['FA_CVR']."</td>";
echo "<td class='space'></td>";
echo "<td class='highlight_cell'>" . number_format($row['HA_SOH'])."</td>";
echo "<td class='highlight_cell'>" . number_format($row['HA_CY'])."</td>";
echo "<td class='highlight_cell'>" . number_format($row['HA_CT'])."</td>";
echo "<td class='highlight_cell'>" . $row['HA_CVR']."</td>";
echo "</tr>";}
else
{
echo "<tr>";
echo "<td class='excel_cell'>" . $row['rgn']."</td>";
echo "<td class='excel_cell'>" . number_format($row['KA_SOH'])."</td>";
echo "<td class='excel_cell'>" . number_format($row['KA_CY'])."</td>";
echo "<td class='excel_cell'>" . number_format($row['KA_CT'])."</td>";
echo "<td class='excel_cell'>" . $row['KA_CVR']."</td>";
echo "<td class='space'></td>";
echo "<td class='excel_cell'>" . number_format($row['MI_SOH'])."</td>";
echo "<td class='excel_cell'>" . number_format($row['MI_CY'])."</td>";
echo "<td class='excel_cell'>" . number_format($row['MI_CT'])."</td>";
echo "<td class='excel_cell'>" . $row['MI_CVR']."</td>";
echo "<td class='space'></td>";
echo "<td class='excel_cell'>" . number_format($row['OT_SOH'])."</td>";
echo "<td class='excel_cell'>" . number_format($row['OT_CY'])."</td>";
echo "<td class='excel_cell'>" . number_format($row['OT_CT'])."</td>";
echo "<td class='excel_cell'>" . $row['OT_CVR']."</td>";
echo "<td class='space'></td>";
echo "<td class='excel_cell'>" . number_format($row['FA_SOH'])."</td>";
echo "<td class='excel_cell'>" . number_format($row['FA_CY'])."</td>";
echo "<td class='excel_cell'>" . number_format($row['FA_CT'])."</td>";
echo "<td class='excel_cell'>" . $row['FA_CVR']."</td>";
echo "<td class='space'></td>";
echo "<td class='excel_cell'>" . number_format($row['HA_SOH'])."</td>";
echo "<td class='excel_cell'>" . number_format($row['HA_CY'])."</td>";
echo "<td class='excel_cell'>" . number_format($row['HA_CT'])."</td>";
echo "<td class='excel_cell'>" . $row['HA_CVR']."</td>";
echo "</tr>";
}
}
echo "</tbody>";
echo "</table>";
mysqli_close($con);
?>
</div>
</main>
<script src="js/jquery-1.11.0.min.js"></script>
<script src="js/jquery.CongelarFilaColumna.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#pruebatabla").CongelarFilaColumna({Columnas:1});
});
</script>
</body>
</html>
CSS
*{
margin: 0;
padding: 0;
border:0;
}
.header, .main {
display: inline-block;
height: auto;
width: 100%;
}
.titulosHeader {
height: auto;
}
.ContenedorTabla {
height: 540px;
border: 1px solid green;
overflow: auto;
position: relative;
max-width:auto;
}
.fht-table,
.fht-table thead,
.fht-table tfoot,
.fht-table tbody,
.fht-table tr,
.fht-table th,
.fht-table td
{
margin: 0;
}
.fht-table{
height: auto;
width: auto;
border-collapse: collapse;
border-spacing: 0;
border: 0 none;
table-layout:fixed;
}
.fht-table th,.fht-table td {
overflow: hidden;
table-layout:fixed;
}
.fht-table-wrapper,
.fht-table-wrapper .fht-thead,
.fht-table-wrapper .fht-tfoot,
.fht-table-wrapper .fht-fixed-column .fht-tbody,
.fht-table-wrapper .fht-fixed-body .fht-tbody,
.fht-table-wrapper .fht-tbody {
overflow: hidden;
position: relative;
}
.fht-table-wrapper .fht-fixed-body .fht-tbody,
.fht-table-wrapper .fht-tbody {
overflow: auto;
}
.fht-table-wrapper .fht-table .fht-cell {
overflow: hidden;
height: 1px;
}
.fht-table-wrapper .fht-fixed-column,
.fht-table-wrapper .fht-fixed-body {
top: 0;
left: 0;
position: absolute;
}
.fht-table-wrapper .fht-fixed-column {
z-index: 1;
}
.fht-fixed-body .fht-thead table {
margin-right: 20px;
border: 0 none;
}
.celda_encabezado_general {
background-color: #4BACC6;
border: 1px solid black;
color: #ffffff;
text-align: center;
font-size: 12px;
font-family: Calibri, sans-serif;
white-space: nowrap;
}
._Separador{
background-color: #fff;
height: 12px;
border-left: 1px solid #ccc;
border-right: 1px solid #ccc;
width: 7px;
}
._Separador div{
width: 4px;
}
.celda_normal {
background-color: #fff;
border: 1px solid #ccc;
padding: 2px 4px;
}
.excel_cell{
border: 1px solid black;
color: #222;
text-align: center;
font-size: 11px;
font-weight: normal;
padding: 5px;
empty-cells: show;
font-family: Calibri, sans-serif;
white-space: nowrap;
}
._cell_header{
background-color: #EEE;
}
._cell_Default{
background-color: #FFF;
text-align: left;
}
.excel_cell div{
width: 30px;
height: 20px;
}
.highlight_cell{
border: 2px solid black;
color: #222;
text-align: center;
font-size: 11px;
font-weight: bold;
padding: 5px;
empty-cells: show;
font-family: Calibri, sans-serif;
white-space: nowrap;
}
.hoverTable tr:hover {
background-color: grey;
}
.space{
border: none;
empty-cells: show;
background-color:grey;
width:10px;
}