css 在php中根据每个特征对齐表中的数据

gg0vcinb  于 2022-12-27  发布在  PHP
关注(0)|答案(1)|浏览(70)

我从mssql数据库中获取要在表中显示的数据。该表有三个类别:订单编号付款状态订单状态
问题如下:我想调整我的订单号与付款状态和订单状态,以便有一个很好的表,很好地对齐。
下面是我在php中的代码和它给我的结果:

<!DOCTYPE html>
 <html>
 <head>
     <meta charset="utf-8">
     <meta name="viewport" content="width=device-width, initial-scale=1">
     <link rel="stylesheet" type="text/css" href="css/clientsS.css">
     <title></title>
 </head>
 <body>
    <div class="BLOC1">
    <div class="NUMBER">
        <center><table>
            <tr>
                <th>NUMERO COMMANDE</th>
                <th>STATUT PAIEMENT</th>
                <th>STATUT COMMANDE</th>
            </tr>

            <tr>
                <td><?php
            //CONNEXION ODBC SERVER//
            $dsn="";
            $user="";
            $password="";
            $conn=odbc_connect($dsn
                ,$user, $password);

            //REQUETES
            $sql = <<<EOF
                    SELECT top 10 [enc_cmd_num]
                    FROM [encaissement]
                    WHERE enc_date= '20221220'
                    EOF;

            $results = odbc_exec($conn,$sql);
            

            while($resultrow = odbc_fetch_array($results)){ 
                echo $resultrow["enc_cmd_num"]."<br/>" ; }
                ?>

            </td>
        </div>

        <div class="TITRE">

            <td><?php
            //CONNEXION ODBC SERVER//
            $dsn="";
            $user="";
            $password="";
            $conn=odbc_connect($dsn,$user, $password);

            //REQUETES
            $sql = <<<EOF
                    SELECT top 10 [enc_paye]
                    FROM [encaissement]
                    WHERE enc_date= '20221220'
                    EOF;

            $results = odbc_exec($conn,$sql);

            //CONDITION
                while($resultrow = odbc_fetch_array($results)) {
                    switch($resultrow['enc_paye']){
                    case 0:
                        echo "<p>En attente paiement</p> \r\n";
                        break;
                    case 1:
                        echo "<p class='green'>Commande payée<p/>\r\n";
                        break;
                }

            }
?>
</td>
                <td><?php
            //CONNEXION ODBC SERVER//
            $dsn="";
            $user="";
            $password="";
            $conn=odbc_connect($dsn,$user, $password);

            //REQUETES
            $sql = <<<EOF
                    SELECT top 10 [enc_prepared]
                    FROM [encaissement]
                    WHERE enc_date= '20221220'
                    EOF;

            $results = odbc_exec($conn,$sql);

            //CONDITION

                while($resultrow = odbc_fetch_array($results)) {
                    switch($resultrow['enc_prepared']){
                    case 0:
                        echo "<p>Commande en attente</p> \r\n";
                        break;
                    case 1:
                        echo "<p class='yellow'>Commande en cours de préparation<p/>\r\n";
                        break;

                }

            }


?>

</td>
</tr>
</table>

</div>

vltsax25

vltsax251#

即使对于第一个<td>,最好也使用相同的标记<p>
像这样测试一下,然后告诉我它是否适合你:

echo "<p>".$resultrow["enc_cmd_num"]."<p/>" ;

取代:

echo $resultrow["enc_cmd_num"]."<br/>" ;

相关问题