How to Creating dynamic table in PHP?

<?php
echo ‘
<table border=”1″ width=”50%”>
<tbody>
<tr>’;
$content = array(1, 2, 3, 4, 5, 6, 7, 8, 9);
$counter = 0;
foreach($content as $data) {
if($counter != 0 && $counter%3 == 0) {
echo “</tr>
<tr>”;
}
echo ”
<td>”;
echo $data;
echo “</td>
“;
$counter++;
}
echo ‘</tr>
</tbody>
</table>
‘;
?>
<table border=”0″ cellspacing=”0″ cellpadding=”0″>
<tbody>
<tr>
<?php
$args = array(
‘numberposts’ => -1,
‘post_parent’ => $post->ID,
‘post_type’ => ‘page’,
‘post_status’ => ‘publish’,
‘orderby’ => ‘menu_order,title’,
‘order’ => ‘ASC’
);
$my_pagelist = &get_children($args);

if ($my_pagelist) {
//                  echo count($my_pagelist);
//echo get_the_post_thumbnail($my_child->ID, ‘thumbnail’, array(‘class’ => ‘ourservices-thumb’));
//echo get_the_post_thumbnail($my_child->ID, ‘medium’, array(‘class’ => ‘ourservices-thumb’));
//echo get_the_post_thumbnail($my_child->ID, ‘full’, array(‘class’ => ‘ourservices-thumb’));
//echo sizeof($my_child).” – “.count($my_child);
//                $count = count($my_child);
$counter = 0;
foreach($my_pagelist as $my_child) {
$my_child_slug = $my_slug . ‘/’. $my_child->post_name.’/’;
if($counter != 0 && $counter%3 == 0) {
echo “</tr>
<tr>”;
}
echo ‘
<td>’;
echo get_the_post_thumbnail($my_child->ID, array(200,120), array(‘class’ => ‘ourservices-thumb’)).’
<h3><a href=”‘.$my_child_slug.'”>”‘.$my_child->post_title.'”</a></h3>
‘;
echo ‘</td>
‘;
$counter++;
}

}
?></tr>
</tbody>
</table>
enjoy just for fun: This is easy for coding guys.
other guys is very diffcult. I am searching more things in google. then i found the solution for this. Thanks for all google users.

That’s all. :)

© 2020 Spirituality