I can not put a new column inside a table

2

I would like you to help me put a column (painted in yellow) as shown in the attached image.

Ialsoleavemycurrentcodetohelp:

<?php$database="anomalias";
    $server="127.0.0.1";

    $connect= mysql_connect('localhost','root','');
    $selecionar= mysql_select_db('anomalias');
    if ($selecionar) 
        {
            $SQL = "SELECT * FROM laboratorios";
            $result = mysql_query($SQL);

            echo"<br>";                
            echo "<table border='1'>";            
            echo "<td style='padding: 10px 20px 10px 20px'><h6>Salas</h6></td>";


            while ($db_field = mysql_fetch_array($result) ) 
            {       
                echo "<td style='padding: 10px 20px 20px 20px'> <a href='phpeditarsala.php?id=".$db_field['sala']."'>".$db_field['sala']."</a></td>";

            }

            echo "</table>";
        }

    ?>  
    
asked by anonymous 12.04.2016 / 21:14

1 answer

1

Your code is embellishing the <tr></tr> tag that designates the lines.

Aesthetically ugly, you can improve this by adding another field on this table where you will put a button on the same line where you printed your result.

<?php
    $database ="anomalias";
    $server="127.0.0.1";

    $connect= mysql_connect('localhost','root','');
    $selecionar= mysql_select_db('anomalias');
    if ($selecionar) 
        {
            $SQL = "SELECT * FROM laboratorios";
            $result = mysql_query($SQL);

            echo"<br>";                
            echo "<table border='1'>";            



            while ($db_field = mysql_fetch_array($result) ) 
            {       
                echo "<tr><td style='padding: 10px 20px 10px 20px'><h6>Salas</h6></td>";
                echo "<td style='padding: 10px 20px 20px 20px'> <a href='phpeditarsala.php?id=".$db_field['sala']."'>".$db_field['sala']."</a></td></tr>";

            }

            echo "</table>";
        }

    ?>  

I think that's it.

    
12.04.2016 / 21:34