how to set up a very extensive table

1

How do I show a form registration by x in the table? the table is very extensive how do I show it as a form vertically rather than horizontally?

    <CENTER><FONT COLOR=BLUE SIZE=6>TABELA</FONT></CENTER>  

    <table  BORDER RULES=all  CELLPADDING=10  ALIGN="center">


                    <tr >

                        <th>Nome</th>
                        <th>Fantasia</th>   
                        <th>Data Fundaçao</th>  
                        <th>Endereço</th>
                        <th>Complemento</th >
                        <th>Bairro</th>
                        <th>Cep</th>
                        <th>Estado</th>
                        <th>Cidade</th>
                        <th>Fone</th>
                        <th>Celular</th>
                        <th>CNPJ</th>
                        <th>Inscrição Estadual</th>
                        <th>Email</th>
                        <th>Contato</th>
                        <th>Data de Nascimento</th> 
                        <th>CPF</th>
                        <th>Endereço Residencial</th>
                        <th>Empresa</th>
                        <th>Fone</th>
                        <th>Empresa</th>
                        <th>Fone</th>
                        <th>Empresa</th>
                        <th>Fone</th>
                        <th>Banco</th>
                        <th>Agencia</th>
                        <th>Conta</th>
                        <th>Contato Banco</th>
                        <th>Fone</th>

                    </tr>

                    <tr>
            <?php while ($i<$qtd1){ ?>
                    <option value="<?php echo $lista_cadastro[$i]->get("idcadastro"); ?>" 

                        </tr>               



                            <td >   
                                <?php                           
                                    echo $lista_cadastro[$i]->get("nome"); ?>                                      
                            </td>

                            <td>
                                <?php echo $lista_cadastro[$i]->get("fantasia"); ?> 
                            </td>  

                            <td>
                                <?php echo $lista_cadastro[$i]->get("datafundacao"); ?> 
                            </td> 
                            <td>
                                <?php echo $lista_cadastro[$i]->get("endereco"); ?> 
                            </td> 
                            <td>
                                <?php echo $lista_cadastro[$i]->get("complemento"); ?> 
                            </td> 
                            <td>
                                <?php echo $lista_cadastro[$i]->get("bairro"); ?> 
                            </td> 
                            <td>
                                <?php echo $lista_cadastro[$i]->get("cep"); ?> 
                            </td> 

                            <td>
                                <?php echo $lista_cadastro[$i]->get("estado"); ?> 
                            </td> 
                            <td>
                                <?php echo $lista_cadastro[$i]->get("cidade"); ?> 
                            </td> 
                            <td>
                                <?php echo $lista_cadastro[$i]->get("fone"); ?> 
                            </td> 
                            <td>
                                <?php echo $lista_cadastro[$i]->get("celular"); ?> 
                            </td> 
                            <td>
                                <?php echo $lista_cadastro[$i]->get("cnpj"); ?> 
                            </td> 
                            <td>
                                <?php echo $lista_cadastro[$i]->get("inscricaoestadual"); ?> 
                            </td> 
                            <td>
                                <?php echo $lista_cadastro[$i]->get("email"); ?> 
                            </td> 
                            <td>
                                <?php echo $lista_cadastro[$i]->get("contato"); ?> 
                            </td> 
                            <td>
                                <?php echo $lista_cadastro[$i]->get("data_nascimento"); ?> 
                            </td> 
                            <td>
                                <?php echo $lista_cadastro[$i]->get("cpf"); ?> 
                            </td> 
                            <td>
                                <?php echo $lista_cadastro[$i]->get("enderecoresidencial"); ?> 
                            </td>
                            <td>
                                <?php echo $lista_cadastro[$i]->get("empresa"); ?> 
                            </td>
                            <td>
                                <?php echo $lista_cadastro[$i]->get("foneempresa"); ?> 
                            </td>
                            <td>
                                <?php echo $lista_cadastro[$i]->get("empresa1"); ?> 
                            </td>
                            <td>
                                <?php echo $lista_cadastro[$i]->get("fone1"); ?> 
                            </td>
                            <td>
                                <?php echo $lista_cadastro[$i]->get("empresa2"); ?> 
                            </td>
                            <td>
                                <?php echo $lista_cadastro[$i]->get("fone2"); ?> 
                            </td>
                            <td>
                                <?php echo $lista_cadastro[$i]->get("banco"); ?> 
                            </td>
                            <td>
                                <?php echo $lista_cadastro[$i]->get("agencia"); ?> 
                            </td>
                            <td>
                                <?php echo $lista_cadastro[$i]->get("conta"); ?> 
                            </td>
                            <td>
                                <?php echo $lista_cadastro[$i]->get("contatobanco"); ?> 
                            </td>
                            <td>
                                <?php echo $lista_cadastro[$i]->get("fonecontato"); ?> 

                            </td> 


                            </tr>                       

                        <?php $i++; 
                                    }?>
                        </table>



            <a href="../index.php?act=sair">Sair</a>        
            <div class="linhaFina"></div>           
            <td>

                <img src="imagens/editar_icon.jpg" alt="Editar" />
            </a>
        </td>

    
asked by anonymous 10.02.2015 / 01:52

1 answer

1

You should make a for and add rows to your table with the information that came back from the database, let's go:

The code below is responsible for generating the rows of the table, so the header must be declared before. Let's assume that in your database you have a table with the ID and NAME columns.

// $registro receberá uma posição do array $registros a cada iteração 
<?php foreach ($registros as $registro) : ?>
    // vamos entao criar uma nova linha na tabela
    // dentro de cada linha teremos duas colunas
    <tr> 
        <td> <?php echo $registro['ID']; ?> </td>
        <td> <?php echo $registro['NOME']; ?> </td>
    </tr>
<?php endforeach; ?> // encerramos o laço.

Pretty simple, right? In this case, every repetition of for is creating a new row, so your table will "grow" vertically.

Hugs and welcome.

    
10.02.2015 / 02:08