Skip to content

Posts from the ‘web programing’ Category

Sep 30 11

Simple and easy php script to create a dynamic table.

by Pietrapania Studio

This is a very simple way i have thought to create a dinamyc table, and put it into a “while” cycle. Despite other examples i used and i had seen in this there is just to change two numbers.

<table width=”100%” border=”0″ cellspacing=”3″ cellpadding=”3″>
           <?

                    $user_products=dbquery(“select * from strut where id_user=$user_id”);
   
     $i=1;
     $max_c=4;
     while($user_pr=mysql_fetch_array($user_products)){
   if($i==$max_c){$i=1;}
                              if($i==1){ ?>  <tr> <? } ?>
                              <td style=”text-align:center”> <? echo $user_pr[title]; ?></td>
                 
           <? if($i==$max_c){ ?>  </tr> <? } ?>
           <? $i++;  } ?> 
       
              </table>