css 从左到右管理您的数据

8zzbczxx  于 2022-12-30  发布在  其他
关注(0)|答案(2)|浏览(125)

我正在做一个项目,包括检索命令并将其显示在屏幕上。
问题是,当命令出现时,它们会自动一个接一个地向下移动到页脚
我想让他们从左边开始,然后继续从右边开始。

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="refresh" content="5" />
    <link rel="stylesheet" type="text/css" href="css/test.css">
    <title></title>
</head>
<body>
    <center>
        <div class="TH">
            <br><br>
                    <ul class='list-column'>
                        <li>
                        <div class="NUMCOMMANDE">
                            <?php
                            $dsn="";
                            $user="";
                            $password="";
                            $conn=odbc_connect($dsn,$user, $password);

                            //REQUETES
                            $sql = <<<EOF
                            SELECT enc_id, enc_cmd_num, enc_paye, enc_prepared, enc_ext_ref, enc_heure_fab_deb, enc_heure_fab_fin, Client.cli_civilite,Client.cli_nom, Client.cli_prenom FROM Client RIGHT JOIN encaissement ON Client.cli_id = encaissement.enc_client WHERE enc_etat<>4 AND enc_date= '20221229' AND ((DATEDIFF(n,enc_heure_fab_fin, getDate()) < 3 AND enc_prepared <> 0) OR enc_prepared = 0) AND enc_emporte <> 1 ORDER BY encaissement.enc_heure_fab_deb ASC
                    EOF;
                            
                            $results = odbc_exec($conn,$sql);
       
                            while($resultrow = odbc_fetch_array($results)){ 
                            echo "<span class='cmdnum'>".$resultrow["enc_cmd_num"]."</span>" ; }
                            ?>

                        </li>

                        <?php
                        $sql = <<<EOF
                        SELECT enc_id, enc_cmd_num, enc_paye, enc_prepared, enc_ext_ref, enc_heure_fab_deb, enc_heure_fab_fin, Client.cli_civilite,Client.cli_nom, Client.cli_prenom FROM Client RIGHT JOIN encaissement ON Client.cli_id = encaissement.enc_client WHERE enc_etat<>4 AND enc_date= '20221229' AND ((DATEDIFF(n,enc_heure_fab_fin, getDate()) < 3 AND enc_prepared <> 0) OR enc_prepared = 0) AND enc_emporte <> 1 ORDER BY encaissement.enc_heure_fab_deb ASC
                    EOF;

                        $results = odbc_exec($conn,$sql);
 
                        if( $results )
                        {
                            while($resultrow = odbc_fetch_array($results))
                            {
                                switch($resultrow['enc_prepared'])
                                {
                                    case 0:
                                        echo"<p class='ENCOURS'>EN PREPARATION<p/>\r \n";
                                        break;
                                    case 1:
                                        echo "<p class='PRETE'>COMMANDE PRÊTE<p/>\r\n";
                                        break;
                                }
                            }
                        }

                        ?>

NEW SCREEN
谢谢大家的帮助

oalqel3c

oalqel3c1#

您可以使用

<ul class='list-column'>
  <li>Item 1</li>
  <li>Item 2</li>
  <li>Item 3</li>
  <li>Item 4</li>
  <li>Item 5</li>
  <li>Item 6</li>
</ul>

在css(或SCSS)中:

.list-column {
    column-count: 3;
    column-gap: 70px;
    padding-left: 0;
}
yh2wf1be

yh2wf1be2#

仍然不完全清楚您想要实现什么,但是我已经重构了您的代码,这可能是一个更好的起点:

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta http-equiv="refresh" content="5" />
  <link rel="stylesheet" type="text/css" href="css/test.css">
  <title></title>
</head>
<body>
  <center>
    <?php
    $dsn="";
    $user="";
    $password="";
    $conn=odbc_connect($dsn,$user, $password);

    //REQUETES
    $sql = <<<EOF
    SELECT enc_id, enc_cmd_num, enc_paye, enc_prepared, enc_ext_ref, enc_heure_fab_deb, enc_heure_fab_fin, Client.cli_civilite,Client.cli_nom, Client.cli_prenom FROM Client RIGHT JOIN encaissement ON Client.cli_id = encaissement.enc_client WHERE enc_etat<>4 AND enc_date= '20221229' AND ((DATEDIFF(n,enc_heure_fab_fin, getDate()) < 3 AND enc_prepared <> 0) OR enc_prepared = 0) AND enc_emporte <> 1 ORDER BY encaissement.enc_heure_fab_deb ASC
EOF;
    $results = odbc_exec($conn,$sql);

    if ($results) {
      while ($resultrow = odbc_fetch_array($results)) {
        echo "<div class='NUMCOMMANDE'>";
        echo "<span class='cmdnum'>".$resultrow["enc_cmd_num"]."</span>" ;
                                
        switch($resultrow['enc_prepared']) {
          case 0:
            echo"<span class='ENCOURS'>EN PREPARATION</span>\r\n";
            break;
          case 1:
            echo "<span class='PRETE'>COMMANDE PRÊTE</span>\r\n";
            break;
          }
          echo '</div>';
        }
      }
      ?>
  </center>
</body>
</html>

我注意到您的SQL语句连接到一个Client表,而该表在其他情况下并不使用,所以我假设您正在对所有这些做其他事情?
如果你输出表格数据,使用<table>可能是合适的。我个人会避免使用,而是使用带有一些CSS的语义标记来视觉上居中内容...但是,我想这取决于你需要它做什么?!

相关问题