How to export multiple HTML tables to an excel file? - php

One record = 1 table.
For 1 record, the formatting is correct. However, for >= 2 records, the width of the table column increases (not sure by how many, I did not see any pattern).
The expected output is that in a single download for multiple records, the tables will be placed below after the other in a single sheet. This is met, but the column widths are messed up for multiple records.
I don't get any errors.
PHP:
echo "<body>";
foreach( $data as $d ){
include('file2.php');
}
echo "</body>";
header("Content-type: application/x-msexcel;charset=UTF-8");
header("Content-Disposition: attachment; filename=" . $filename);
header("Pragma: no-cache");
header("Expires: 0");
file2.php (please disregard the class, I have removed the .css styling)
<table border=0 cellpadding=0 cellspacing=0 width=718 style='border-collapse:
collapse; table-layout:fixed; width:553pt'>
<col width=18 style='mso-width-source:userset;width:14pt'>
<col width=20 style='mso-width-source:userset;width:15pt'>
<col width=18 span=17 style='mso-width-source:userset;
width:14pt'>
<col width=22 style='mso-width-source:userset;width:17pt'>
<col width=18 span=4 style='mso-width-source:userset;
width:14pt'>
<col width=22 style='mso-width-source:userset;width:17pt'>
<col width=18 span=2 style='mso-width-source:userset;
width:14pt'>
<col width=8 style='mso-width-source:userset;width:6pt'>
<col width=20 style='mso-width-source:userset;width:15pt'>
<!-- <col class=xl223 width=10 style='mso-width-source:userset;mso-width-alt:658;width-alt:20pt'> -->
<col class=xl170 width=18 style='mso-width-source:userset;
width:14pt'>
<col width=17 style='mso-width-source:userset;width:13pt'>
<col width=12 style='mso-width-source:userset;width:9pt'>
<col width=82 style='mso-width-source:userset;width:62pt'>
<col width=64 style='width:48pt'>
<!-- <col width=1 style='mso-width-source:userset;mso-width-alt:36;width:1pt'> -->
<tr height=12 style='mso-height-source:userset;height:9.0pt'>
<td height=12 width=18 style='height:9.0pt;width:14pt' align=left valign=top>
<![if !vml]><span style='mso-ignore:vglayout;
position:absolute;z-index:47;margin-left:5px;margin-top:0px;width:702px;
height:90px'><img width=702 height=90 src='<?php echo $hdr_image; ?>' v:shapes="Line_x0020_191 Rectangle_x0020_229 Rectangle_x0020_230 Rectangle_x0020_231 Picture_x0020_232 Rectangle_x0020_234 Rectangle_x0020_235 Rectangle_x0020_237 Rectangle_x0020_239 Text_x0020_Box_x0020_241 Text_x0020_Box_x0020_242"></span><![endif]>
<span
style='mso-ignore:vglayout2'>
<table cellpadding=0 cellspacing=0>
<tr>
<td height=12 class=xl69 width=18 style='height:9.0pt;width:14pt'></td>
</tr>
</table>
</span>
</td>
<td class=xl162 colspan=2 width=38 style='mso-ignore:colspan;width:29pt'>Column:</td>
<td class=xl70 width=18 style='width:14pt'></td>
<td class=xl70 width=18 style='width:14pt'></td>
<td class=xl70 width=18 style='width:14pt'></td>
<td class=xl70 width=18 style='width:14pt'></td>
<td class=xl70 width=18 style='width:14pt'></td>
<td class=xl70 width=18 style='width:14pt'></td>
<td class=xl70 width=18 style='width:14pt'></td>
<td class=xl70 width=18 style='width:14pt'></td>
<td class=xl70 width=18 style='width:14pt'></td>
<td class=xl70 width=18 style='width:14pt'></td>
<td class=xl70 width=18 style='width:14pt'></td>
<td class=xl70 width=18 style='width:14pt'></td>
<td class=xl70 width=18 style='width:14pt'></td>
<td class=xl71 width=18 style='width:14pt'></td>
<td class=xl70 width=18 style='width:14pt'></td>
<td class=xl70 width=18 style='width:14pt'></td>
<td class=xl70 width=22 style='width:17pt'></td>
<td class=xl70 width=18 style='width:14pt'></td>
<td class=xl70 width=18 style='width:14pt'></td>
<td class=xl70 width=18 style='width:14pt'></td>
<td class=xl70 width=18 style='width:14pt'></td>
<td class=xl70 width=22 style='width:17pt'></td>
<td class=xl70 width=18 style='width:14pt'></td>
<td class=xl70 width=18 style='width:14pt'></td>
<td class=xl70 width=8 style='width:6pt'></td>
<td class=xl70 width=20 style='width:15pt'></td>
<td class=xl164 width=18 style='width:14pt'></td>
<td class=xl70 width=17 style='width:13pt'></td>
<td class=xl70 width=12 style='width:9pt'></td>
<td class=xl70 width=82 style='width:62pt'></td>
<td class=xl70 width=64 style='width:48pt'></td>
<td class=xl70 width=64 style='width:48pt'></td>
<td width=1 style='width:1pt'></td>
</tr>
<tr height=17 style='height:12.75pt'>
<td height=17 class=xl143 style='height:12.75pt'> </td>
<td class=xl144> </td>
<td class=xl144> </td>
<td class=xl144> </td>
<td class=xl144> </td>
<td class=xl144> </td>
<td class=xl144> </td>
<td class=xl144> </td>
<td class=xl144> </td>
<td class=xl144> </td>
<td class=xl144> </td>
<td class=xl144> </td>
<td class=xl144> </td>
<td class=xl144> </td>
<td class=xl144> </td>
<td class=xl144> </td>
<td class=xl144> </td>
<td class=xl144> </td>
<td class=xl144> </td>
<td class=xl144> </td>
<td class=xl144> </td>
<td class=xl144> </td>
<td class=xl144> </td>
<td class=xl144> </td>
<td class=xl144> </td>
<td class=xl144> </td>
<td class=xl144> </td>
<td class=xl144> </td>
<td class=xl144> </td>
<td class=xl165> </td>
<td class=xl144> </td>
<td class=xl144> </td>
<td class=xl144> </td>
<td class=xl144> </td>
<td class=xl145> </td>
</tr>
<tr height=16 style='mso-height-source:userset;height:12.0pt'>
<td height=16 class=xl146 style='height:12.0pt'> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl166> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl148> </td>
<td></td>
</tr>
<tr height=16 style='mso-height-source:userset;height:12.0pt'>
<td height=16 class=xl146 style='height:12.0pt'> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl166> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl148> </td>
<td></td>
</tr>
<tr height=4 style='mso-height-source:userset;height:3.0pt'>
<td height=4 class=xl146 style='height:3.0pt'> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl166> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl148> </td>
<td></td>
</tr>
<tr height=22 style='mso-height-source:userset;height:16.5pt'>
<td height=22 class=xl149 style='height:16.5pt'> </td>
<td class=xl150> </td>
<td class=xl150> </td>
<td class=xl150> </td>
<td class=xl150> </td>
<td class=xl150> </td>
<td class=xl150> </td>
<td class=xl150> </td>
<td class=xl150> </td>
<td class=xl150> </td>
<td class=xl150> </td>
<td class=xl150> </td>
<td class=xl150> </td>
<td class=xl150> </td>
<td class=xl150> </td>
<td class=xl150> </td>
<td class=xl150> </td>
<td class=xl150> </td>
<td class=xl150> </td>
<td class=xl150> </td>
<td class=xl150> </td>
<td class=xl150> </td>
<td class=xl150> </td>
<td class=xl150> </td>
<td class=xl150> </td>
<td class=xl150> </td>
<td class=xl150> </td>
<td class=xl150> </td>
<td class=xl150> </td>
<td class=xl167> </td>
<td class=xl150> </td>
<td class=xl150><span></span></td>
<td class=xl150> </td>
<td class=xl150> </td>
<td class=xl148> .</td>
<!-- <td class=xl150> </td>
<td class=xl151> </td> -->
<td></td>
</tr>
<tr height=12 style='mso-height-source:userset;height:9.0pt'>
<td height=12 class=xl161 colspan=20 style='height:9.0pt;mso-ignore:colspan'>Sample text here</td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl166> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl147> </td>
<td class=xl260> </td>
<td></td>
</tr>
<tr class=xl101 height=11 style='mso-height-source:userset;height:3.0pt'>
<td class=xl258></td>
<td class=xl257></td>
<td class=xl257></td>
<td class=xl257></td>
<td class=xl257></td>
<td class=xl257></td>
<td class=xl257></td>
<td class=xl257></td>
<td class=xl257></td>
<td class=xl257></td>
<td class=xl257></td>
<td class=xl257></td>
<td class=xl257></td>
<td class=xl257></td>
<td class=xl257></td>
<td class=xl257></td>
<td class=xl257></td>
<td class=xl257></td>
<td class=xl257></td>
<td class=xl257></td>
<td class=xl257></td>
<td class=xl257></td>
<td class=xl257></td>
<td class=xl257></td>
<td class=xl257></td>
<td class=xl257></td>
<td class=xl257></td>
<td class=xl257></td>
<td class=xl257></td>
<td class=xl257></td>
<td class=xl257></td>
<td class=xl257></td>
<td class=xl257></td>
<td class=xl257></td>
<td class=xl259></td>
</tr>
<tr class=xl101 height=11 style='mso-height-source:userset;height:2.0pt'>
<td class=xl230></td>
<td class=xl235></td>
<td class=xl235></td>
<td class=xl235></td>
<td class=xl235></td>
<td class=xl235></td>
<td class=xl235></td>
<td class=xl235></td>
<td class=xl235></td>
<td class=xl235></td>
<td class=xl235></td>
<td class=xl235></td>
<td class=xl235></td>
<td class=xl235></td>
<td class=xl235></td>
<td class=xl235></td>
<td class=xl235></td>
<td class=xl235></td>
<td class=xl235></td>
<td class=xl237></td>
<td class=xl235></td>
<td class=xl235></td>
<td class=xl235></td>
<td class=xl235></td>
<td class=xl235></td>
<td class=xl235></td>
<td class=xl235></td>
<td class=xl235></td>
<td class=xl235></td>
<td class=xl235></td>
<td class=xl235></td>
<td class=xl235></td>
<td class=xl235></td>
<td class=xl235></td>
<td class=xl237></td>
</tr>
<![endif]>
</table>

Instead of using multiple <table></table> tags, I just had to use <tbody></tbody> inside the loop and enclose them in a single parent table.

Related

Get only the table rows from the first table - Simple HTML Dom (PHP)

<table border="3" rules="all" cellpadding="1" cellspacing="1">
<tbody>
<tr>
<td align="center">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td align="center" nowrap="1"><font size="2" face="Arial" color="#000000"> <b>Maandag</b> </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td align="center" nowrap="1"><font size="2" face="Arial"> <b>Dinsdag</b> </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td align="center" nowrap="1"><font size="2" face="Arial"> <b>Woensdag</b> </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td align="center" nowrap="1"><font size="2" face="Arial"> <b>Donderdag</b> </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td align="center" nowrap="1"><font size="2" face="Arial"> <b>Vrijdag</b> </font>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td align="center" nowrap="1"><font size="2" face="Arial"> <b>1</b> </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="18" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td width="33%" nowrap="1"><font size="2" face="Arial"> *verlof </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td width="33%" nowrap="1"><font size="2" face="Arial"> *in_4. </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> O114 </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> V6A </font>
</td>
</tr>
<tr>
<td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V6C </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr></tr>
<tr>
<td rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td align="center" nowrap="1"><font size="2" face="Arial"> <b>2</b> </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td width="33%" nowrap="1"><font size="2" face="Arial"> *in_3. </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> O114 </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> V4B </font>
</td>
</tr>
<tr>
<td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V4C </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td width="33%" nowrap="1"><font size="2" face="Arial"> *in_7. </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> V4B </font>
</td>
</tr>
<tr>
<td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V4A </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr></tr>
<tr>
<td rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td align="center" nowrap="1"><font size="2" face="Arial"> <b>3</b> </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td width="33%" nowrap="1"><font size="2" face="Arial"> *in_1. </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> V6A </font>
</td>
</tr>
<tr>
<td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V6C </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td width="33%" nowrap="1"><font size="2" face="Arial"> *in_1. </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> V6A </font>
</td>
</tr>
<tr>
<td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V6C </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr></tr>
<tr>
<td rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td align="center" nowrap="1"><font size="2" face="Arial"> <b>4</b> </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr></tr>
<tr>
<td rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td align="center" nowrap="1"><font size="2" face="Arial"> <b>5</b> </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td width="33%" nowrap="1"><font size="2" face="Arial"> stip </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> Os1 </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td width="33%" nowrap="1"><font size="2" face="Arial"> *in_5. </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> V5B </font>
</td>
</tr>
<tr>
<td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V5C </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td width="33%" nowrap="1"><font size="2" face="Arial"> *in_5. </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> V5B </font>
</td>
</tr>
<tr>
<td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V5C </font>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr></tr>
<tr>
<td rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td align="center" nowrap="1"><font size="2" face="Arial"> <b>6</b> </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td width="33%" nowrap="1"><font size="2" face="Arial"> *in_3. </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> V4B </font>
</td>
</tr>
<tr>
<td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V4C </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td width="33%" nowrap="1"><font size="2" face="Arial"> *in_3. </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> V4B </font>
</td>
</tr>
<tr>
<td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V4C </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr></tr>
<tr>
<td rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td align="center" nowrap="1"><font size="2" face="Arial"> <b>7</b> </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td width="33%" nowrap="1"><font size="2" face="Arial"> *in_4. </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> V6A </font>
</td>
</tr>
<tr>
<td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V6C </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td width="33%" nowrap="1"><font size="2" face="Arial"> *in_7. </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> V4B </font>
</td>
</tr>
<tr>
<td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V4A </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td width="33%" nowrap="1"><font size="2" face="Arial"> *in_4. </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> V6A </font>
</td>
</tr>
<tr>
<td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V6C </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td width="33%" nowrap="1"><font size="2" face="Arial"> *in_7. </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> V4B </font>
</td>
</tr>
<tr>
<td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V4A </font>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr></tr>
<tr>
<td rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td align="center" nowrap="1"><font size="2" face="Arial"> <b>8</b> </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td width="33%" nowrap="1"><font size="2" face="Arial"> *in_5. </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> V5B </font>
</td>
</tr>
<tr>
<td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V5C </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td width="33%" nowrap="1"><font size="2" face="Arial"> *in_1. </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> V6A </font>
</td>
</tr>
<tr>
<td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V6C </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr></tr>
<tr>
<td rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td align="center" nowrap="1"><font size="2" face="Arial"> <b>9</b> </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr></tr>
</tbody>
</table>
My school supplies me with the following timetable (as seen above), but when I want to parse the table using simplehtmldom. From this table I want to collect the data so that I can use it in my App.
What query in simplehtmldom can i use to select only the first table rows?
Like this: Table->(all rows)
When I try this query: echo($html->find('table tr',0)); And I change the the zero to 2 (for example), it doesn't return the next table row of the main table. But Instead it returns the frist table row of sub table in the first table row.
Not that I can't change the way the table is presented, this is the table I have to work with.
What I get now when I execute: echo($html->find('table tr',2)); -> "Maandag"
What I would like to get: <tr><td rowspan="2" align="center" nowrap="1"><table><tbody><tr><td align="center" nowrap="1"><font size="2" face="Arial"> <b>2</b> </font> </td> </tr></tbody></table></td> <td colspan="12" rowspan="2" align="center" nowrap="1"><table><tbody><tr><td></td></tr></tbody></table></td> <td colspan="12" rowspan="2" align="center" nowrap="1"><table><tbody><tr><td width="33%" nowrap="1"><font size="2" face="Arial"> *in_3. </font> </td> <td width="33%" nowrap="1"><font size="2" face="Arial"> O114 </font> </td> <td width="33%" nowrap="1"><font size="2" face="Arial"> V4B </font> </td> </tr><tr><td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V4C </font> </td> </tr></tbody></table></td> <td colspan="12" rowspan="2" align="center" nowrap="1"><table><tbody><tr><td width="33%" nowrap="1"><font size="2" face="Arial"> *in_7. </font> </td> <td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font> </td> <td width="33%" nowrap="1"><font size="2" face="Arial"> V4B </font> </td> </tr><tr><td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V4A </font> </td> </tr></tbody></table></td> <td colspan="12" rowspan="2" align="center" nowrap="1"><table><tbody><tr><td></td></tr></tbody></table></td></tr> (the next tablerow of the first (main) table)
The way I load in the html table:
$html = file_get_html($timetableURL);
$timeTable = $html->find('table',0); //I need to do this because the page with the timetable has more html tables, I tested this and it always fetches the timetable as seen above.
A related question: PHP Simple HTML DOM Parser how to get TR only from first table
Only I want to select the second or third row of the first table for example.
echo($timeTable->find('tr',2));
It's a little bit convoluted with simple-html-dom:
// find the first table
$table = $html->find('table', 0);
// iterate all tr's
foreach($table->find('tr') as $tr){
// skip the tr's that are not top level
if($tr->parent->parent != $table) continue;
do_something_with($tr);
}
I used a while loop and the simple-html-dom nextSibling() function.
$tableCell = $row->find('td', 0);
while($tableCell){
$tableCell = $tableCell->next_sibling(); //Go to the next tableCell
}
You can use jQuery selector :first to fetch the first element from the DOM
You can do it like this:
$(function() {
var table = $('table:first');
var table_rows = table.find('tr');
alert(" There are " + table_rows.length + " rows in Table");
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<table border="3" rules="all" cellpadding="1" cellspacing="1">
<tbody>
<tr>
<td align="center">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td align="center" nowrap="1"><font size="2" face="Arial" color="#000000"> <b>Maandag</b> </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td align="center" nowrap="1"><font size="2" face="Arial"> <b>Dinsdag</b> </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td align="center" nowrap="1"><font size="2" face="Arial"> <b>Woensdag</b> </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td align="center" nowrap="1"><font size="2" face="Arial"> <b>Donderdag</b> </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td align="center" nowrap="1"><font size="2" face="Arial"> <b>Vrijdag</b> </font>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td align="center" nowrap="1"><font size="2" face="Arial"> <b>1</b> </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="18" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td width="33%" nowrap="1"><font size="2" face="Arial"> *verlof </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td width="33%" nowrap="1"><font size="2" face="Arial"> *in_4. </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> O114 </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> V6A </font>
</td>
</tr>
<tr>
<td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V6C </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr></tr>
<tr>
<td rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td align="center" nowrap="1"><font size="2" face="Arial"> <b>2</b> </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td width="33%" nowrap="1"><font size="2" face="Arial"> *in_3. </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> O114 </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> V4B </font>
</td>
</tr>
<tr>
<td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V4C </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td width="33%" nowrap="1"><font size="2" face="Arial"> *in_7. </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> V4B </font>
</td>
</tr>
<tr>
<td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V4A </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr></tr>
<tr>
<td rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td align="center" nowrap="1"><font size="2" face="Arial"> <b>3</b> </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td width="33%" nowrap="1"><font size="2" face="Arial"> *in_1. </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> V6A </font>
</td>
</tr>
<tr>
<td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V6C </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td width="33%" nowrap="1"><font size="2" face="Arial"> *in_1. </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> V6A </font>
</td>
</tr>
<tr>
<td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V6C </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr></tr>
<tr>
<td rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td align="center" nowrap="1"><font size="2" face="Arial"> <b>4</b> </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr></tr>
<tr>
<td rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td align="center" nowrap="1"><font size="2" face="Arial"> <b>5</b> </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td width="33%" nowrap="1"><font size="2" face="Arial"> stip </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> Os1 </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td width="33%" nowrap="1"><font size="2" face="Arial"> *in_5. </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> V5B </font>
</td>
</tr>
<tr>
<td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V5C </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td width="33%" nowrap="1"><font size="2" face="Arial"> *in_5. </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> V5B </font>
</td>
</tr>
<tr>
<td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V5C </font>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr></tr>
<tr>
<td rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td align="center" nowrap="1"><font size="2" face="Arial"> <b>6</b> </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td width="33%" nowrap="1"><font size="2" face="Arial"> *in_3. </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> V4B </font>
</td>
</tr>
<tr>
<td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V4C </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td width="33%" nowrap="1"><font size="2" face="Arial"> *in_3. </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> V4B </font>
</td>
</tr>
<tr>
<td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V4C </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr></tr>
<tr>
<td rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td align="center" nowrap="1"><font size="2" face="Arial"> <b>7</b> </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td width="33%" nowrap="1"><font size="2" face="Arial"> *in_4. </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> V6A </font>
</td>
</tr>
<tr>
<td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V6C </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td width="33%" nowrap="1"><font size="2" face="Arial"> *in_7. </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> V4B </font>
</td>
</tr>
<tr>
<td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V4A </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td width="33%" nowrap="1"><font size="2" face="Arial"> *in_4. </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> V6A </font>
</td>
</tr>
<tr>
<td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V6C </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td width="33%" nowrap="1"><font size="2" face="Arial"> *in_7. </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> V4B </font>
</td>
</tr>
<tr>
<td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V4A </font>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr></tr>
<tr>
<td rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td align="center" nowrap="1"><font size="2" face="Arial"> <b>8</b> </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td width="33%" nowrap="1"><font size="2" face="Arial"> *in_5. </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> V5B </font>
</td>
</tr>
<tr>
<td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V5C </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td width="33%" nowrap="1"><font size="2" face="Arial"> *in_1. </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> O112 </font>
</td>
<td width="33%" nowrap="1"><font size="2" face="Arial"> V6A </font>
</td>
</tr>
<tr>
<td colspan="3" width="33%" nowrap="1"><font size="2" face="Arial"> V6C </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr></tr>
<tr>
<td rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td align="center" nowrap="1"><font size="2" face="Arial"> <b>9</b> </font>
</td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
<td colspan="12" rowspan="2" align="center" nowrap="1">
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr></tr>
</tbody>
</table>
Hope this helps!
Traversing your DOM Structure, and I find that the tr that you want is the 4th child tr, which directly under a tbody element under the table.
So, the query you need might be something like this
// assume table is the root/parent DOM
$tr = $table->find('tbody > tr:nth-child(4)');
var_dump($tr->html());
Sorry if the php syntax is incorrect. That is actually tested against phpquery library.

Adding next row fields to previous row in mySQL using PHP

I have a table with unix timestamp, userID, Long and lat. I would like to copy the value of Long and Lat from the following row and add them to that row. Please see below.
<table style="width: 645px;" border="0" cellspacing="0" cellpadding="0">
<colgroup>
<col width="140" />
<col width="57" />
<col span="7" width="64" />
</colgroup>
<tbody>
<tr>
<td class="xl66" width="140" height="21">Unix Time Stamp</td>
<td class="xl66" width="57"> </td>
<td class="xl66" width="64">Long</td>
<td class="xl66" width="64"> </td>
<td class="xl66" width="64">Lat</td>
<td class="xl66" width="64"> </td>
<td class="xl66" width="64"> </td>
<td class="xl66" width="64"> </td>
<td class="xl66" width="64"> </td>
</tr>
<tr>
<td class="xl67" align="right" width="140" height="20">1458119939</td>
<td class="xl77" width="57"> </td>
<td class="xl70" align="right">-26.2004</td>
<td class="xl70"> </td>
<td class="xl70" align="right">28.01277</td>
<td class="xl70"> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td class="xl68" align="right" width="140" height="21">1458119940</td>
<td class="xl77" width="57"> </td>
<td class="xl70" align="right">26.20654</td>
<td class="xl70"> </td>
<td class="xl70" align="right">28.04565</td>
<td class="xl70"> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td class="xl68" align="right" width="140" height="20">1458128756</td>
<td class="xl71" width="57"> </td>
<td class="xl71" align="right" width="64">-29.0065</td>
<td class="xl77" width="64"> </td>
<td class="xl72" align="right" width="64">29.88437</td>
<td class="xl77" width="64"> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td class="xl68" align="right" width="140" height="20">1458128757</td>
<td class="xl71" width="57"> </td>
<td class="xl71" align="right" width="64">-29.0067</td>
<td class="xl77" width="64"> </td>
<td class="xl72" align="right" width="64">29.88465</td>
<td class="xl77" width="64"> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td class="xl68" align="right" width="140" height="20">1442829381</td>
<td class="xl71" width="57"> </td>
<td class="xl71" align="right" width="64">-29.0064</td>
<td class="xl77" width="64"> </td>
<td class="xl72" align="right" width="64">29.88458</td>
<td class="xl77" width="64"> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td class="xl68" align="right" width="140" height="21">1442829397</td>
<td class="xl71" width="57"> </td>
<td class="xl73" align="right" width="64">-29.0062</td>
<td class="xl78" width="64"> </td>
<td class="xl74" align="right" width="64">29.88436</td>
<td class="xl77" width="64"> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td class="xl69" align="right" width="140" height="21">1442830988</td>
<td class="xl73" width="57"> </td>
<td class="xl75" align="right" width="64">-26.2065</td>
<td class="xl79" width="64"> </td>
<td class="xl76" align="right" width="64">28.04565</td>
<td class="xl77" width="64"> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td height="20"> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td height="20"> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td class="xl65" colspan="3" height="20">Query Result needs to look like</td>
<td class="xl65"> </td>
<td class="xl65"> </td>
<td class="xl65"> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td class="xl66" height="21">Unix Time Stamp</td>
<td class="xl66"> </td>
<td class="xl66">Long</td>
<td class="xl66"> </td>
<td class="xl66">Lat</td>
<td class="xl66"> </td>
<td class="xl66">LongB</td>
<td class="xl66"> </td>
<td class="xl66">LatB</td>
</tr>
<tr>
<td class="xl67" align="right" width="140" height="20">1458119939</td>
<td class="xl77" width="57"> </td>
<td class="xl70" align="right">-26.2004</td>
<td class="xl70"> </td>
<td class="xl70" align="right">28.01277</td>
<td class="xl70"> </td>
<td class="xl70" align="right">26.20654</td>
<td class="xl70"> </td>
<td class="xl70" align="right">28.04565</td>
</tr>
<tr>
<td class="xl68" align="right" width="140" height="20">1458119940</td>
<td class="xl77" width="57"> </td>
<td class="xl70" align="right">26.20654</td>
<td class="xl70"> </td>
<td class="xl70" align="right">28.04565</td>
<td class="xl70"> </td>
<td class="xl71" align="right" width="64">-29.0065</td>
<td class="xl77" width="64"> </td>
<td class="xl72" align="right" width="64">29.88437</td>
</tr>
<tr>
<td class="xl68" align="right" width="140" height="20">1458128756</td>
<td class="xl71" width="57"> </td>
<td class="xl71" align="right" width="64">-29.0065</td>
<td class="xl77" width="64"> </td>
<td class="xl72" align="right" width="64">29.88437</td>
<td class="xl77" width="64"> </td>
<td class="xl71" align="right" width="64">-29.0067</td>
<td class="xl77" width="64"> </td>
<td class="xl72" align="right" width="64">29.88465</td>
</tr>
<tr>
<td class="xl68" align="right" width="140" height="20">1458128757</td>
<td class="xl71" width="57"> </td>
<td class="xl71" align="right" width="64">-29.0067</td>
<td class="xl77" width="64"> </td>
<td class="xl72" align="right" width="64">29.88465</td>
<td class="xl77" width="64"> </td>
<td class="xl71" align="right" width="64">-29.0064</td>
<td class="xl77" width="64"> </td>
<td class="xl72" align="right" width="64">29.88458</td>
</tr>
<tr>
<td class="xl68" align="right" width="140" height="21">1442829381</td>
<td class="xl71" width="57"> </td>
<td class="xl71" align="right" width="64">-29.0064</td>
<td class="xl77" width="64"> </td>
<td class="xl72" align="right" width="64">29.88458</td>
<td class="xl77" width="64"> </td>
<td class="xl73" align="right" width="64">-29.0062</td>
<td class="xl78" width="64"> </td>
<td class="xl74" align="right" width="64">29.88436</td>
</tr>
<tr>
<td class="xl68" align="right" width="140" height="21">1442829397</td>
<td class="xl71" width="57"> </td>
<td class="xl73" align="right" width="64">-29.0062</td>
<td class="xl78" width="64"> </td>
<td class="xl74" align="right" width="64">29.88436</td>
<td class="xl78" width="64"> </td>
<td class="xl75" align="right" width="64">-26.2065</td>
<td class="xl79" width="64"> </td>
<td class="xl76" align="right" width="64">28.04565</td>
</tr>
</tbody>
</table>
Your help would be very much appreciated.
SELECT timestamp, userID, Long, Lat, Long as LongB, Lat as LatB FROM table
I think you meant column instead of row

xpath got wrong html attribute

So, I have this PHP scraper code and HTML below that I want to scrape using Xpath.
When I try to scrape every #href, it shows outerHTML 14, when it is supposes to be 14
The #href is cut in half where the space are. What causes this?
$content = $xpath->query('//a');
foreach($content as $c){
var_dump(htmlspecialchars($c->C14N())); echo '<br>';
}
The one above is the CURL code.
Here is the HTML.
<div class="outercalendar" id="maincalendar821"><table class="calendarHeader">
<tbody><tr>
<td><input type="button" onclick="AjxGetMainCalendarMonth('2', '2015', '821')" value="<"></td>
<td class="calendarHeader" colspan="5">March 2015</td>
<td><input type="button" onclick="AjxGetMainCalendarMonth('4', '2015', '821')" value=">"></td>
</tr>
</tbody></table>
<table class="calendar">
<tbody><tr>
<td class="calendarDay">S</td>
<td class="calendarDay">M</td>
<td class="calendarDay">T</td>
<td class="calendarDay">W</td>
<td class="calendarDay">T</td>
<td class="calendarDay">F</td>
<td class="calendarDay">S</td>
</tr>
<tr>
<td class="calendar">1</td>
<td class="calendar"> </td>
<td class="calendar"> </td>
<td class="calendar"> </td>
<td class="calendar"> </td>
<td class="calendar"> </td>
<td class="calendar">7</td>
</tr>
<tr>
<td class="calendar">8</td>
<td class="calendar"> </td>
<td class="calendar"> </td>
<td class="calendar"> </td>
<td class="calendar"> </td>
<td class="calendar"> </td>
<td class="calendar">14</td>
</tr>
<tr>
<td class="calendar">15</td>
<td class="calendar"> </td>
<td class="calendar"> </td>
<td class="calendar"> </td>
<td class="calendar"> </td>
<td class="calendar"> </td>
<td class="calendar">21</td>
</tr>
<tr>
<td class="calendar">22</td>
<td class="calendar"> </td>
<td class="calendar"> </td>
<td class="calendar"> </td>
<td class="calendar"> </td>
<td class="calendar"> </td>
<td class="calendar">28</td>
</tr>
<tr>
<td class="calendar">29</td>
<td class="calendar"> </td>
<td class="calendar"> </td>
<td class="calendar"> </td>
<td class="calendar"> </td>
<td class="calendar"> </td>
<td class="calendar"> </td>
</tr>
</tbody></table>
</div>
The issue could be in the structure of the info stored in the tag.
I would suggest starting with a more detailed xpath:
//a/#href
so your initial code would be:
$content = $xpath->query('//a/#href');

display column data in each table data

---------------------------------------------------------------------
Quantity | Unit | Detials of Items | ISSUED DATE | RETURNED |
| | | | |
---------------------------------------------------------------------
tbl col 1 |tbl col2 | tbl col2 | tbl col 3 | tbl col4 |
---------------------------------------------------------------------
say I have a table in the database that has 4 columns
and that is the table in my website
how would i display my table column data in each table data?
any suggestion please
I only have this codes so far as I am new to php i just use macromedia for the interface
$myServer = "server";
$myUser = "user";
$myPass = "password";
$myDB = "mssqldb";
//connection to the database
$dbhandle = mssql_connect($myServer, $myUser, $myPass)
or die("Couldn't connect to SQL Server on $myServer");
//select a database to work with
$selected = mssql_select_db($myDB, $dbhandle)
or die("Couldn't open database $myDB");
//declare the SQL statement that will query the database
$query = "SELECT eidnumber ";
$query .= "FROM tablename ";
<table width="935" height="102" border="1">
<tr>
<th width="89" rowspan="2" scope="col">Quantity</th>
<th width="87" rowspan="2" scope="col">Unit</th>
<th width="137" rowspan="2" scope="col">Details of Item(s) Accounted </th>
<th width="221" rowspan="2" scope="col">ISSUED DATE </th>
<th height="51" colspan="3" scope="col">RETURNED</th>
<th width="254" rowspan="2" scope="col">
<p>REMARKS</p> </th>
</tr>
<tr>
<th width="24" height="39" scope="col">C</th>
<th width="18" scope="col">X</th>
<th width="53" scope="col">DATE</th>
</tr>
</table>
<table width="935" border="1">
<tr>
<td width="90"> </td>
<td width="86"> </td>
<td width="137"> </td>
<td width="221"> </td>
<td width="24"> </td>
<td width="17"> </td>
<td width="55"> </td>
<td width="253"> </td>
</tr>
<tr>
<td width="90"> </td>
<td width="86"> </td>
<td width="137"> </td>
<td width="221"> </td>
<td width="24"> </td>
<td width="17"> </td>
<td width="55"> </td>
<td width="253"> </td>
</tr>
<tr>
<td width="90"> </td>
<td width="86"> </td>
<td width="137"> </td>
<td width="221"> </td>
<td width="24"> </td>
<td width="17"> </td>
<td width="55"> </td>
<td width="253"> </td>
</tr>
<tr>
<td width="90"> </td>
<td width="86"> </td>
<td width="137"> </td>
<td width="221"> </td>
<td width="24"> </td>
<td width="17"> </td>
<td width="55"> </td>
<td width="253"> </td>
</tr>
<tr>
<td width="90"> </td>
<td width="86"> </td>
<td width="137"> </td>
<td width="221"> </td>
<td width="24"> </td>
<td width="17"> </td>
<td width="55"> </td>
<td width="253"> </td>
</tr>
<tr>
<td width="90"> </td>
<td width="86"> </td>
<td width="137"> </td>
<td width="221"> </td>
<td width="24"> </td>
<td width="17"> </td>
<td width="55"> </td>
<td width="253"> </td>
</tr>
<tr>
<td width="90"> </td>
<td width="86"> </td>
<td width="137"> </td>
<td width="221"> </td>
<td width="24"> </td>
<td width="17"> </td>
<td width="55"> </td>
<td width="253"> </td>
</tr>
<tr>
<td width="90"> </td>
<td width="86"> </td>
<td width="137"> </td>
<td width="221"> </td>
<td width="24"> </td>
<td width="17"> </td>
<td width="55"> </td>
<td width="253"> </td>
</tr>
<tr>
<td width="90"> </td>
<td width="86"> </td>
<td width="137"> </td>
<td width="221"> </td>
<td width="24"> </td>
<td width="17"> </td>
<td width="55"> </td>
<td width="253"> </td>
</tr>
<tr>
<td width="90"> </td>
<td width="86"> </td>
<td width="137"> </td>
<td width="221"> </td>
<td width="24"> </td>
<td width="17"> </td>
<td width="55"> </td>
<td width="253"> </td>
</tr>
<tr>
<td width="90"> </td>
<td width="86"> </td>
<td width="137"> </td>
<td width="221"> </td>
<td width="24"> </td>
<td width="17"> </td>
<td width="55"> </td>
<td width="253"> </td>
</tr>
<tr>
<td width="90"> </td>
<td width="86"> </td>
<td width="137"> </td>
<td width="221"> </td>
<td width="24"> </td>
<td width="17"> </td>
<td width="55"> </td>
<td width="253"> </td>
</tr>
<tr>
<td width="90"> </td>
<td width="86"> </td>
<td width="137"> </td>
<td width="221"> </td>
<td width="24"> </td>
<td width="17"> </td>
<td width="55"> </td>
<td width="253"> </td>
</tr>
<tr>
<td width="90"> </td>
<td width="86"> </td>
<td width="137"> </td>
<td width="221"> </td>
<td width="24"> </td>
<td width="17"> </td>
<td width="55"> </td>
<td width="253"> </td>
</tr>
<tr>
<td width="90"> </td>
<td width="86"> </td>
<td width="137"> </td>
<td width="221"> </td>
<td width="24"> </td>
<td width="17"> </td>
<td width="55"> </td>
<td width="253"> </td>
</tr>
</table>
If you're using PDO, which is a better approach:
echo "<table>";
$sql = $this->db->query("SELECT * FROM YOUR_TABLE");
while($row = $sql->fetch(PDO::FETCH_ASSOC))
{
echo "
<tr>
<td>". $row['quantity'] ."</td>
<td>". $row['unit'] ."</td>
<td>". $row['details'] ."</td>
<td>". $row['issued_date'] ."</td>
<td>". $row['returned'] ."</td>
</tr>
";
}
echo "</table>";
Or if you're mysql_ functions, which are deprecated:
echo "<table>";
$sql = mysql_query("SELECT * FROM YOUR_TABLE");
while($row = mysql_fetch_assoc($sql))
{
echo "
<tr>
<td>". $row['quantity'] ."</td>
<td>". $row['unit'] ."</td>
<td>". $row['details'] ."</td>
<td>". $row['issued_date'] ."</td>
<td>". $row['returned'] ."</td>
</tr>
";
}
echo "/<table>";
In addition to the above answer, you can also use mysqli. Here's an example:
$result = $mysqli->query($query);
while ($row = $result->fetch_object()){
echo "<tr>";
echo "<td>" . $row->quantity . "</td>"
...etc...
}

How do I extract values from a html page stored as string using curl function

I am using PHP / curl to get a HTML into a string and then i need to extract the following data and then project a graph out of it .
The data I want looks like :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="generator" content=
"HTML Tidy for Linux (vers 25 March 2009), see www.w3.org" />
<title></title>
</head>
<body>
<table>
<tbody>
<tr>
<td>
<h3>Income</h3>
</td>
</tr>
<tr>
<td>Operating income</td>
<td class="numericalColumn">22,922.00</td>
<td class="numericalColumn">21,507.30</td>
<td class="numericalColumn">17,492.60</td>
<td class="numericalColumn">13,683.90</td>
<td class="numericalColumn">10,227.12</td>
</tr>
<tr>
<td>
<h3>Expenses</h3>
</td>
</tr>
<tr>
<td>Material consumed</td>
<td class="numericalColumn">4,029.40</td>
<td class="numericalColumn">3,442.60</td>
<td class="numericalColumn">2,952.30</td>
<td class="numericalColumn">1,889.00</td>
<td class="numericalColumn">1,367.67</td>
</tr>
<tr>
<td>Manufacturing expenses </td>
<td class="numericalColumn">2,213.20</td>
<td class="numericalColumn">1,841.80</td>
<td class="numericalColumn">299.80</td>
<td class="numericalColumn">120.50</td>
<td class="numericalColumn">1,020.70</td>
</tr>
<tr>
<td>Personnel expenses</td>
<td class="numericalColumn">9,062.80</td>
<td class="numericalColumn">9,249.80</td>
<td class="numericalColumn">7,409.10</td>
<td class="numericalColumn">5,768.20</td>
<td class="numericalColumn">4,279.03</td>
</tr>
<tr>
<td>Selling expenses</td>
<td class="numericalColumn">378.10</td>
<td class="numericalColumn">308.40</td>
<td class="numericalColumn">532.10</td>
<td class="numericalColumn">-</td>
<td class="numericalColumn">171.05</td>
</tr>
<tr>
<td>Adminstrative expenses</td>
<td class="numericalColumn">1,737.00</td>
<td class="numericalColumn">1,906.00</td>
<td class="numericalColumn">2,583.70</td>
<td class="numericalColumn">2,651.70</td>
<td class="numericalColumn">904.78</td>
</tr>
<tr>
<td>Expenses capitalised</td>
<td class="numericalColumn">-</td>
<td class="numericalColumn">-</td>
<td class="numericalColumn">-</td>
<td class="numericalColumn">-</td>
<td class="numericalColumn">-</td>
</tr>
<tr>
<td>Cost of sales</td>
<td class="numericalColumn">17,420.50</td>
<td class="numericalColumn">16,748.60</td>
<td class="numericalColumn">13,777.00</td>
<td class="numericalColumn">10,429.40</td>
<td class="numericalColumn">7,743.22</td>
</tr>
<tr>
<td>Operating profit</td>
<td class="numericalColumn">5,501.50</td>
<td class="numericalColumn">4,758.70</td>
<td class="numericalColumn">3,715.60</td>
<td class="numericalColumn">3,254.50</td>
<td class="numericalColumn">2,483.90</td>
</tr>
<tr>
<td>Other recurring income</td>
<td class="numericalColumn">434.20</td>
<td class="numericalColumn">468.20</td>
<td class="numericalColumn">326.90</td>
<td class="numericalColumn">288.70</td>
<td class="numericalColumn">113.59</td>
</tr>
<tr>
<td>Adjusted PBDIT</td>
<td class="numericalColumn">5,935.70</td>
<td class="numericalColumn">5,226.90</td>
<td class="numericalColumn">4,042.50</td>
<td class="numericalColumn">3,543.20</td>
<td class="numericalColumn">2,597.49</td>
</tr>
<tr>
<td>Financial expenses</td>
<td class="numericalColumn">108.40</td>
<td class="numericalColumn">196.80</td>
<td class="numericalColumn">116.80</td>
<td class="numericalColumn">7.20</td>
<td class="numericalColumn">3.13</td>
</tr>
<tr>
<td>Depreciation </td>
<td class="numericalColumn">579.60</td>
<td class="numericalColumn">533.60</td>
<td class="numericalColumn">456.00</td>
<td class="numericalColumn">359.80</td>
<td class="numericalColumn">292.26</td>
</tr>
<tr>
<td>Other write offs</td>
<td class="numericalColumn">-</td>
<td class="numericalColumn">-</td>
<td class="numericalColumn">-</td>
<td class="numericalColumn">-</td>
<td class="numericalColumn">-</td>
</tr>
<tr>
<td>Adjusted PBT</td>
<td class="numericalColumn">5,247.70</td>
<td class="numericalColumn">4,496.50</td>
<td class="numericalColumn">3,469.70</td>
<td class="numericalColumn">3,176.20</td>
<td class="numericalColumn">2,302.10</td>
</tr>
<tr>
<td>Tax charges </td>
<td class="numericalColumn">790.80</td>
<td class="numericalColumn">574.10</td>
<td class="numericalColumn">406.40</td>
<td class="numericalColumn">334.10</td>
<td class="numericalColumn">286.10</td>
</tr>
<tr>
<td>Adjusted PAT</td>
<td class="numericalColumn">4,456.90</td>
<td class="numericalColumn">3,922.40</td>
<td class="numericalColumn">3,063.30</td>
<td class="numericalColumn">2,842.10</td>
<td class="numericalColumn">2,016.00</td>
</tr>
<tr>
<td>Non recurring items</td>
<td class="numericalColumn">441.10</td>
<td class="numericalColumn">-948.60</td>
<td class="numericalColumn">-</td>
<td class="numericalColumn">-</td>
<td class="numericalColumn">38.33</td>
</tr>
<tr>
<td>Other non cash adjustments</td>
<td class="numericalColumn">-</td>
<td class="numericalColumn">-</td>
<td class="numericalColumn">-</td>
<td class="numericalColumn">-</td>
<td class="numericalColumn">-33.85</td>
</tr>
<tr>
<td>Reported net profit</td>
<td class="numericalColumn">4,898.00</td>
<td class="numericalColumn">2,973.80</td>
<td class="numericalColumn">3,063.30</td>
<td class="numericalColumn">2,842.10</td>
<td class="numericalColumn">2,020.48</td>
</tr>
<tr>
<td>Earnigs before appropriation</td>
<td class="numericalColumn">4,898.00</td>
<td class="numericalColumn">2,973.80</td>
<td class="numericalColumn">3,063.30</td>
<td class="numericalColumn">2,842.10</td>
<td class="numericalColumn">2,020.48</td>
</tr>
<tr>
<td>Equity dividend</td>
<td class="numericalColumn">880.90</td>
<td class="numericalColumn">586.00</td>
<td class="numericalColumn">876.50</td>
<td class="numericalColumn">873.70</td>
<td class="numericalColumn">712.88</td>
</tr>
<tr>
<td>Preference dividend</td>
<td class="numericalColumn">-</td>
<td class="numericalColumn">-</td>
<td class="numericalColumn">-</td>
<td class="numericalColumn">-</td>
<td class="numericalColumn">-</td>
</tr>
<tr>
<td>Dividend tax</td>
<td class="numericalColumn">128.30</td>
<td class="numericalColumn">99.60</td>
<td class="numericalColumn">148.90</td>
<td class="numericalColumn">126.80</td>
<td class="numericalColumn">99.98</td>
</tr>
<tr>
<td>Retained earnings</td>
<td class="numericalColumn">3,888.80</td>
<td class="numericalColumn">2,288.20</td>
<td class="numericalColumn">2,037.90</td>
<td class="numericalColumn">1,841.60</td>
<td class="numericalColumn">1,207.62</td>
</tr>
</tbody>
</table>
</body>
</html>
I want to extract each value like Manufacturing Data and the values of all the years mentioned in that line. How do I go about this?
I found something like preg_match('#<tr><th>(.*)</th> <td><b>price</b></td></tr>#', $content, $match); but that doesn't get the values I want.
If i understood you question well you want something like this to be done. this was written by me so if you need clarifications i'd love to help.
cheers !
You can use libraries like PHP Simple HTML DOM Parser to extract data from HTML/XHTML.
http://simplehtmldom.sourceforge.net/manual.htm
An example:
$pageDom = str_get_html( $rawHtmlData );
foreach( $pageDom->find( 'td' ) as $tblElem )
{
if( FALSE !== stristr( $tblElem->innertext, 'Manufacturing expenses' ) )
{
// Do stuff
}
}

Categories