i want to export this table to a variable
$tbl=<<<EOT
<table cellspacing="0" cellpadding="1" border="1">
<tr>
<td rowspan="3">$res=mysql_query($sql);<br />COLSPAN 3</td>
<td>COL 2 - ROW 1</td>
<td>COL 3 - ROW 1</td>
</tr>
<tr>
<td rowspan="2">COL 2 - ROW 2 - COLSPAN 2<br />text line<br />text line<br />text line<br />text line</td>
<td>COL 3 - ROW 2</td>
</tr>
<tr>
<td>COL 3 - ROW 3</td>
</tr>
</table>
EOT;
but the following code appeared as text !!
=mysql_query();
You can't use functions inside the EOT block.
You have to define a variable outside of it to use it inside the EOT block:
$res = mysql_query($sql);
$tbl=<<<EOT
<table cellspacing="0" cellpadding="1" border="1">
<tr>
<td rowspan="3">$res<br/>COLSPAN 3</td>
<td>COL 2 - ROW 1</td>
<td>COL 3 - ROW 1</td>
</tr>
<tr>
<td rowspan="2">COL 2 - ROW 2 - COLSPAN 2<br/>text line<br/>text line<br/>text line<br/>text line</td>
<td>COL 3 - ROW 2</td>
</tr>
<tr>
<td>COL 3 - ROW 3</td>
</tr>
</table>
EOT;
Related
I have a table in which i want to make the column 1,3,4 filled in with this color
"#e1e1e1". How may i do so?
https://www.sebuys.com/shop/windows-10-customised-i7-i5-7th-gen-rgb-gaming-tower-16gb-8gb-ddr4-pc-computer/
Check out the nth-child selector: http://css-tricks.com/useful-nth-child-recipies
td:nth-child(1),
td:nth-child(3),
td:nth-child(4){
background-color: #e1e1e1;
}
<table>
<tbody>
<tr>
<td>Col 1</td>
<td>Col 2</td>
<td>Col 3</td>
<td>Col 4</td>
</tr>
<tr>
<td>Col 1</td>
<td>Col 2</td>
<td>Col 3</td>
<td>Col 4</td>
</tr>
<tr>
<td>Col 1</td>
<td>Col 2</td>
<td>Col 3</td>
<td>Col 4</td>
</tr>
<tr>
<td>Col 1</td>
<td>Col 2</td>
<td>Col 3</td>
<td>Col 4</td>
</tr>
</tbody>
</table>
When I print the following page, the borders on the second page are not shown (see image below). The HTML tags are working though. How can I get the borders also on the second page?
#media print {
thead {
display: table-header-group;
}
}
<table width="100%" bordercolor="#000000" style=" border-collapse:collapse; border:1px solid #000000" border="1" cellpadding="5" cellspacing="0">
<tbody>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</tbody>
</table>
try to set the border-collapse to initial and define the attribute cellspacing=0 in the table. It solve the problem to me
table {
border-collapse: separate;
border : 0px solid #000000;
border-spacing: 0;
font-size: 11pt;
width: 100%;
border-color: #000000 ;
border-right: 1px solid;
}
i am using border-collapse: separate;
table {
border-collapse: separate;
border-spacing: 0;
width: 100%;
}
table,tr,th,td {
color:red;
border : 1px solid #000000;
}
<table>
<tr>
<th>head 1</th>
<th>head 2</th>
<th>head 3</th>
</tr>
<tr>
<td>Col 1</td>
<td>Col 2</td>
<td>Col 3</td>
</tr>
<tr>
<td>Col 1</td>
<td>Col 2</td>
<td>Col 3</td>
</tr>
<tr>
<td>Col 1</td>
<td>Col 2</td>
<td>Col 3</td>
</tr>
<tr>
<td>Col 1</td>
<td>Col 2</td>
<td>Col 3</td>
</tr>
<tr>
<td>Col 1</td>
<td>Col 2</td>
<td>Col 3</td>
</tr>
<tr>
<td>Col 1</td>
<td>Col 2</td>
<td>Col 3</td>
</tr>
<tr>
<td>Col 1</td>
<td>Col 2</td>
<td>Col 3</td>
</tr>
<tr>
<td>Col 1</td>
<td>Col 2</td>
<td>Col 3</td>
</tr>
<tr>
<td>Col 1</td>
<td>Col 2</td>
<td>Col 3</td>
</tr>
<tr>
<td>Col 1</td>
<td>Col 2</td>
<td>Col 3</td>
</tr>
<tr>
<td>Col 1</td>
<td>Col 2</td>
<td>Col 3</td>
</tr>
<tr>
<td>Col 1</td>
<td>Col 2</td>
<td>Col 3</td>
</tr>
<tr>
<td>Col 1</td>
<td>Col 2</td>
<td>Col 3</td>
</tr>
<tr>
<td>Col 1</td>
<td>Col 2</td>
<td>Col 3</td>
</tr>
<tr>
<td>Col 1</td>
<td>Col 2</td>
<td>Col 3</td>
</tr>
<tr>
<td>Col 1</td>
<td>Col 2</td>
<td>Col 3</td>
</tr>
<tr>
<td>Col 1</td>
<td>Col 2</td>
<td>Col 3</td>
</tr>
<tr>
<td>Col 1</td>
<td>Col 2</td>
<td>Col 3</td>
</tr>
<tr>
<td>Col 1</td>
<td>Col 2</td>
<td>Col 3</td>
</tr>
<tr>
<td>Col 1</td>
<td>Col 2</td>
<td>Col 3</td>
</tr>
<tr>
<td>Col 1</td>
<td>Col 2</td>
<td>Col 3</td>
</tr>
<tr>
<td>Col 1</td>
<td>Col 2</td>
<td>Col 3</td>
</tr>
<tr>
<td>Col 1</td>
<td>Col 2</td>
<td>Col 3</td>
</tr>
<tr>
<td>Col 1</td>
<td>Col 2</td>
<td>Col 3</td>
</tr>
<tr>
<td>Col 1</td>
<td>Col 2</td>
<td>Col 3</td>
</tr>
<tr>
<td>Col 1</td>
<td>Col 2</td>
<td>Col 3</td>
</tr>
<tr>
<td>Col 1</td>
<td>Col 2</td>
<td>Col 3</td>
</tr>
<tr>
<td>Col 1</td>
<td>Col 2</td>
<td>Col 3</td>
</tr>
<tr>
<td>Col 1</td>
<td>Col 2</td>
<td>Col 3</td>
</tr>
<tr>
<td>Col 1</td>
<td>Col 2</td>
<td>Col 3</td>
</tr>
<tr>
<td>Col 1</td>
<td>Col 2</td>
<td>Col 3</td>
</tr>
<tr>
<td>Col 1</td>
<td>Col 2</td>
<td>Col 3</td>
</tr>
<tr>
<td>Col 1</td>
<td>Col 2</td>
<td>Col 3</td>
</tr>
<tr>
<td>Col 1</td>
<td>Col 2</td>
<td>Col 3</td>
</tr>
<tr>
<td>Col 1</td>
<td>Col 2</td>
<td>Col 3</td>
</tr>
<tr>
<td>Col 1</td>
<td>Col 2</td>
<td>Col 3</td>
</tr>
<tr>
<td>Col 1</td>
<td>Col 2</td>
<td>Col 3</td>
</tr>
<tr>
<td>Col 1</td>
<td>Col 2</td>
<td>Col 3</td>
</tr>
<tr>
<td>Col 1</td>
<td>Col 2</td>
<td>Col 3</td>
</tr>
<tr>
<td>Col 1</td>
<td>Col 2</td>
<td>Col 3</td>
</tr>
<tr>
<td>Col 1</td>
<td>Col 2</td>
<td>Col 3</td>
</tr>
<tr>
<td>Col 1</td>
<td>Col 2</td>
<td>Col 3</td>
</tr>
<tr>
<td>Col 1</td>
<td>Col 2</td>
<td>Col 3</td>
</tr>
<tr>
<td>Col 1</td>
<td>Col 2</td>
<td>Col 3</td>
</tr>
<tr>
<td>Col 1</td>
<td>Col 2</td>
<td>Col 3</td>
</tr>
<tr>
<td>Col 1</td>
<td>Col 2</td>
<td>Col 3</td>
</tr>
<tr>
<td>Col 1</td>
<td>Col 2</td>
<td>Col 3</td>
</tr>
<tr>
<td>Col 1</td>
<td>Col 2</td>
<td>Col 3</td>
</tr>
<tr>
<td>Col 1</td>
<td>Col 2</td>
<td>Col 3</td>
</tr>
<tr>
<td>Col 1</td>
<td>Col 2</td>
<td>Col 3</td>
</tr>
<tr>
<td>Col 1</td>
<td>Col 2</td>
<td>Col 3</td>
</tr>
<tr>
<td>Col 1</td>
<td>Col 2</td>
<td>Col 3</td>
</tr>
<tr>
<td>Col 1</td>
<td>Col 2</td>
<td>Col 3</td>
</tr>
<tr>
<td>Col 1</td>
<td>Col 2</td>
<td>Col 3</td>
</tr>
</table>
My code is:
for($i=$start_time; $i<$end_time; $i+=86400){
echo '<tr>';
echo '<td ROWSPAN=4>';
echo date('d/m/Y', $i);
echo '</td>';
echo '</tr>';
for($j=1;$j<4;$j++){
while($row1=mysql_fetch_assoc($res1))
{
echo '<tr>';
echo '<td width=100px>'."1".'</td>';
echo '<td>'.$row1['karmname'].'</td>';
echo '<td>'.$row1['karmdesi'].'</td>';
echo '<td>'.$row1['karmoffice'].'</td>';
echo '<td>'.$row1['karmmobile'].'</td>';
echo '</tr>';
}
}
}
But in output I want proper format first row is proper but in second row date 02/01/2015 print after data print. so in all the rows I want proper data like first row. kindly help me out to resolve this issue.
thanks in advance.
I can't work out from your question which way around you want your table to show, but one of these layouts should work for you:
<table border=1>
<tr>
<td colspan='5'>heading</td>
</tr>
<tr>
<td>Row 1</td>
<td>Row 2</td>
<td>Row 3</td>
<td>Row 4</td>
<td>Row 5</td>
</tr>
</table>
<table border=1>
<tr>
<td rowspan='5'>heading</td>
<td>Row 1</td>
</tr>
<tr>
<td>Row 2</td>
</tr>
<tr>
<td>Row 3</td>
</tr>
<tr>
<td>Row 4</td>
</tr>
<tr>
<td>Row 5</td>
</tr>
</table>
Just want to display html table with TCPDF but getting errors instead.
Here is my code:
$tbl = <<<EOD
<table cellspacing="0" cellpadding="1" border="1">
<tr>
<td >
aaaaa
</td>
<td colspan="2" rowspan="2" >
bbbb
</td>
</tr>
<td rowspan="2">
hhhhh
</td>
</tr>
<tr>
<td>
iiii
</td>
<td>
jjjj
</td>
</tr>
</table>
EOD;
But when I replace my html table code with following html table code (from TCPDF examples), it displays correctly:
$tbl = <<<EOD
<table cellspacing="0" cellpadding="1" border="1">
<tr>
<td rowspan="3">COL 1 - ROW 1<br />COLSPAN 3</td>
<td>COL 2 - ROW 1</td>
<td>COL 3 - ROW 1</td>
</tr>
<tr>
<td rowspan="2">COL 2 - ROW 2 - COLSPAN 2<br />text line<br />text line</td>
<td>COL 3 - ROW 2</td>
</tr>
<tr>
<td>COL 3 - ROW 3</td>
</tr>
</table>
EOD;
Could you please check my html table code and help me to find the mistake.
After the first <tr>, you have an extra </tr>, making the document invalid. Indented, your HTML is:
<table cellspacing="0" cellpadding="1" border="1">
<tr>
<td>aaaaa</td>
<td colspan="2" rowspan="2">bbbb</td>
</tr>
<td rowspan="2">hhhhh</td>
</tr>
<tr>
<td>iiii</td>
<td>jjjj</td>
</tr>
</table>
The code im using as follows
ob_start();
?>
<table cellspacing="0" cellpadding="1" border="1">
<tr>
<td align="center" rowspan="3"><br /><? echo "لا اله الا الله"; ?></td>
<td align="center" class="exclude">COL 2 - ROW 1</td>
<td align="center">COL 3 - ROW 1</td>
</tr>
<tr>
<td align="center" rowspan="2">COL 2 - ROW 2 - COLSPAN 2<br />text line<br />text line<br />text line<br />text line</td>
<td align="center">COL 3 - ROW 2</td>
</tr>
<tr>
<td align="center">COL 3 - ROW 3</td>
</tr>
</table>
<?
$tbl=ob_get_clean();
i want to exclude or filter some cells from the above code before send it for another processing
You can then create a style which will hide those cells for you.
ob_start();
?>
<style>
.exclude{display:none}
</style>
<table cellspacing="0" cellpadding="1" border="1">
...