how to set up a very extensive table

Asked

Viewed 91 times

1

How do I show a form form by x in the table? the table is very extensive as do p show it as a form vertically and not 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>

  • 1

    Hi Sergio, welcome :) Come on, how much do you know about PHP? You can already add content to your database and query it?

  • Place part of the code, an image of how you are and how you can improve the understanding of the question. Use the link editar to add more details to your question, take a look at some tips on how the site works on tour

1 answer

1

You must make a for and go adding lines to your table with the information that returned from the bank, come on:

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

// $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.

Quite simple, no? In this case, every repetition of the for we are creating a new row so your table will "grow" vertically.

Hugs and welcome back.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.