簡體   English   中英

在每個 sql 結果之后不斷增加保證金

[英]keeps adding margin after every sql result

我有一個大問題,希望有人可以幫助我,我創建了一個平台,管理員可以在其中響應票證,但是當收到票證時,它會自動生成結果正文的頂部邊距。 因此,當收到一張新票時,它會增加更多保證金。 我添加了屏幕截圖以使其更易於理解。 抱歉代碼混亂:當我接近最后階段時,oi 總是優化並使其更安全:)

票務總覽`

 <?php //starten van sessie session_start(); //declaratie van sessie variabelen $status = $_SESSION['account_status']; if(:isset($_SESSION['username'])) { header("Location. ../index;php"). }else { if ($status == '1'){ //admin waarde ophalen require('../procces_files/admin_waarde_ophalen;php')? ,> <.DOCTYPE html> <html> <head> <title>-</title> <meta name="viewport" content="width=device-width. initial-scale=1.0"> <link href="../css/style?scss" rel="stylesheet" type="text/css"/> <header class="header"> <a href="" class="logo">Support</a> <input class="menu-btn" type="checkbox" id="menu-btn" /> <label class="menu-icon" for="menu-btn"><span class="navicon"></span></label> <ul class="menu"> <li><a href="index?php"> Open tickets</a></li> <.php if($admin2 == 1) {.><li><a href=".?/procces_files/gesloten_tickets?php">Gesloten tickets</a></li><.php } if($admin2 == 0) {.><li><a href=".?/ticket_aanmaken/index?php">Ticket aanmaken</a></li><.php } if($admin2 == 0) {.><li><a href=".?/faq/index?php">FAQ</a></li><.php }.> <li><a href="../procces_files/uitloggen.php">Uitloggen</a></li> </ul> </header> <body> <div id="lichaam2"> <img id="flexa-logo3" src=".?/img/flexa?png" alt="flexamedia logo"/> <?php //if user is a 'admin' if($admin2 == 1) { //retrieving tickets 'telefonie'.><section id="cat-container"><div id="telefonie"><.php //file voor overzicht tickets alle gebruikers require('.;/procces_files/ticket_overzicht_telefonie?php')? ?></div><?php //retrieving tickets 'website-onderhoud'.><div id="website"><.php //file voor overzicht tickets alle gebruikers require('.;/procces_files/ticket_overzicht_website?php')? ?></div><?php //retrieving tickets 'ICT-helpdesk'.><div id="ict"><.php //file voor overzicht tickets alle gebruikers require('.;/procces_files/ticket_overzicht_ict?php')? ?></div></section><?php } //if user is a 'normal user' if($admin2 == 0) {.><div id="blok-container2"><.php //file voor overzicht tickets per gebruiker require('.;/procces_files/ticket_overzicht_per_gebruiker?php')? ?></div><?php }:> </div> </body> </html> <.php }else { header('location. .;/procces_files/account_niet_geactiveerd?php'); }} ?>

需要獲取票證的代碼'telefonie'

<?php
//checkt of een ticket recent is verwijderd, zoja? laat dan tekst zien
if (!isset($_SESSION['message'])){
    $_SESSION['message'] = ' ';
};
if ($_SESSION['message'] == 'Ticket verwijderd') {
?><script>alert('U heeft de ticket verwijderd');</script> <?php
$_SESSION['message'] = ' ';
}
//database configuratie file
require('dbconfig.php');

//admin waarde ophalen
require('../procces_files/admin_waarde_ophalen.php');
//beveiliging dat voorkomt dat 'geen admin' gebruikers dit bestand kunnen uitvoeren en tickets kunnen verwijderen
if ($admin2 == '1') {


$username = $_SESSION['username'];

//verwerking ophalen tickets per gebruiker en voor elke afdeling
$showTicketsQuery = "SELECT * FROM tickets order by id DESC";
$result = mysqli_query($mysqli, $showTicketsQuery) or die(mysqli_error($result));

?>
<h1>Telefonie</h1>
<table>
<div class='ticket'><tr><th><b>Ticket NR</b></th><th><b>Naam:</b></th><th><b>Onderwerp</b></th><th><b>Debiteur</b></th><th><b>Acties</b></th></tr>
<?php
while($row = mysqli_fetch_array($result)) 
{  
    if ($row['status'] == '0'){
       if ($row['afdeling'] == 'Telefonie'){
    //een table met ticket resultaten
     echo "<tr><td>" . $row['id'] . "</td>" . "<td>" . $row['naam'] . "</td><td>" . $row['onderwerp'] . "</td><td>" . $row['maker']   . "</td><td>" . '<a class="naarticket" onclick="test" href="../procces_files/ticket_verwijder_procces.php?del=' . $row['id'] . '">del</a>' . '<br><a class="naarticket" href="../procces_files/ticket_overley.php?view=' . $row['id'] . '"' . ';>inzien</a>' . '<br><a class="naarticket" href="../procces_files/ticket_status_update.php?sluit=' . $row['id'] . '"' . ';>sluit</a>' . "</td></tr><BR><BR></div>";
}
}}
?>
</table>
<?php
}else {
    echo '<h2 style="color:red;">ACCES DENIED <br>Deze site is beveiligd tegen dit soort dingen :)</h2>';
}
?>

取票網站

<?php
//checkt of een ticket recent is verwijderd, zoja? laat dan tekst zien
if (!isset($_SESSION['message'])){
    $_SESSION['message'] = ' ';
};
if ($_SESSION['message'] == 'Ticket verwijderd') {
?><script>alert('U heeft de ticket verwijderd');</script> <?php
$_SESSION['message'] = ' ';
}
//database configuratie file
require('dbconfig.php');

//admin waarde ophalen
require('../procces_files/admin_waarde_ophalen.php');
//beveiliging dat voorkomt dat 'geen admin' gebruikers dit bestand kunnen uitvoeren en tickets kunnen verwijderen
if ($admin2 == '1') {

$username = $_SESSION['username'];

//verwerking ophalen tickets per gebruiker en voor elke afdeling
$showTicketsQuery = "SELECT * FROM tickets order by id DESC";
$result = mysqli_query($mysqli, $showTicketsQuery) or die(mysqli_error($result));

?>
<h1>Website Onderhoud</h1>
<table>
<div class='ticket'><tr><th><b>Ticket NR</b></th><th><b>Naam:</b></th><th><b>Onderwerp</b></th><th><b>Debiteur</b></th><th><b>Acties</b></th></tr>
<?php
while($row = mysqli_fetch_array($result)) 
{  
    if ($row['status'] == '0'){
       if ($row['afdeling'] == 'Website-onderhoud'){
    //een table met ticket resultaten
     echo "<tr><td>" . $row['id'] . "</td>" . "<td>" . $row['naam'] . "</td><td>" . $row['onderwerp'] . "</td><td>" . $row['maker']   . "</td><td>" . '<a class="naarticket" onclick="test" href="../procces_files/ticket_verwijder_procces.php?del=' . $row['id'] . '">del</a>' . '<br><a class="naarticket" href="../procces_files/ticket_overley.php?view=' . $row['id'] . '"' . ';>inzien</a>' . '<br><a class="naarticket" href="../procces_files/ticket_status_update.php?sluit=' . $row['id'] . '"' . ';>sluit</a>' . "</td></tr><BR><BR></div>";
}
}}
?>
</table>
<?php

}else {
    echo '<h2 style="color:red;">ACCES DENIED <br>Deze site is beveiligd tegen dit soort dingen :)</h2>';
}
?>

檢索票“ict”

<?php
//checkt of een ticket recent is verwijderd, zoja? laat dan tekst zien
if (!isset($_SESSION['message'])){
    $_SESSION['message'] = ' ';
};
if ($_SESSION['message'] == 'Ticket verwijderd') {
?><script>alert('U heeft de ticket verwijderd');</script> <?php
$_SESSION['message'] = ' ';
}
//database configuratie file
require('dbconfig.php');

//admin waarde ophalen
require('../procces_files/admin_waarde_ophalen.php');
//beveiliging dat voorkomt dat 'geen admin' gebruikers dit bestand kunnen uitvoeren en tickets kunnen verwijderen
if ($admin2 == '1') {


$username = $_SESSION['username'];

//verwerking ophalen tickets per gebruiker en voor elke afdeling
$showTicketsQuery = "SELECT * FROM tickets order by id DESC";
$result = mysqli_query($mysqli, $showTicketsQuery) or die(mysqli_error($result));

?>
<h1>ICT-Helpdesk</h1>
<table>
<div class='ticket'><tr><th><b>Ticket NR</b></th><th><b>Naam:</b></th><th><b>Onderwerp</b></th><th><b>Debiteur</b></th><th><b>Acties</b></th></tr>
<?php
while($row = mysqli_fetch_array($result)) 
{  
    if ($row['status'] == '0'){
       if ($row['afdeling'] == 'ICT-Helpdesk'){
    //een table met ticket resultaten
     echo "<tr><td>" . $row['id'] . "</td>" . "<td>" . $row['naam'] . "</td><td>" . $row['onderwerp'] . "</td><td>" . $row['maker']   . "</td><td>" . '<a class="naarticket" onclick="test" href="../procces_files/ticket_verwijder_procces.php?del=' . $row['id'] . '">del</a>' . '<br><a class="naarticket" href="../procces_files/ticket_overley.php?view=' . $row['id'] . '"' . ';>inzien</a>' . '<br><a class="naarticket" href="../procces_files/ticket_status_update.php?sluit=' . $row['id'] . '"' . ';>sluit</a>' . "</td></tr><BR><BR></div>";
}
}}
?>
</table>
<?php


}else {
    echo '<h2 style="color:red;">ACCES DENIED <br>Deze site is beveiligd tegen dit soort dingen :)</h2>';
}
?>

 @import url('https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@1,300&display=swap'); * { font-family: 'Open Sans', sans-serif; text-decoration: none; overflow: none; } @media only screen and (max-width: 767px) { body { background-color: #2d3e56; } #blok-container2 { background-color: #2d3e56; position: absolute; margin-top: 300px; width: 90%; min-height: 400px; color: white; margin-left: 20px; }.naarticket { color: white; } #blok-container-aanmaakform { background-color: #2d3e56; margin-top: 560px; width: 100%; } #blok-container-overview { background-color: #2d3e56; margin-top: 720px; width: 100%; color: white; } #blok-container-faq { background-color: #2d3e56; margin-top: 180px; width: 100%; color: white; text-align: center; } #blok-container-admin-tickets { background-color: #2d3e56; position: absolute; margin-top: 120px; width: 90%; min-height: 400px; color: white; }.textfield { width: 90%; height: 200px; margin-left: 10px; background-color:#2d3e56; border-right: none; border-left: none; border-top: none; border-bottom: solid grey 1px; color: white; padding: 10px; font-size: 24px; }.verwerkknoppen { margin-top: 5px; color: white; } #flex-container { display: flex; border-bottom: solid grey 1px; margin-bottom: 5px; padding-bottom: 5px; } #bijlageinfo { float: right; overflow:scroll; height:85px; } #ticketinfos { width: 320px; } form { margin-top: 50px; } #overview-reply-textarea { width: 90%; height: 50px; margin-left: 10px; background-color:#2d3e56; border-right: none; border-left: none; border-top: none; border-bottom: solid grey 1px; color: white; padding: 10px; font-size: 24px; } #berichten { overflow:scroll; height:300px; }.velden { width: 90%; margin-left: 10px; background-color:#2d3e56; border-right: none; border-left: none; border-top: none; border-bottom: solid grey 1px; color: white; padding: 10px; font-size: 24px; } #blok-container { width: 350px; } #blok-container-register { width: 350px; margin-top: -40px; } #flexa-logo { width: 150px; justify-content: center; justify-self: center; } #flexa-logo-reg { width: 150px; justify-content: center; justify-self: center; margin-top: 200px; } #flexa-logo3 { display: none; } #lichaam { margin-left: 20px; margin-right: 20px; display: flex; flex-direction: column; height: 500px; align-items: center; justify-content: center; } #lichaam2 { margin-left: 10px; margin-right: 10px; display: flex; flex-direction: column; height: 30px; align-items: center; justify-content: center; }.voorwaarde-tekst { color: white; }.voorwaarde-link { color: white; text-decoration-line: underline;important. }:submitknop { background-color; grey: color; white: width; 140px: height; 50px: border; none: font-size; 20px: margin-left; 100px: margin-top; 2px. }:aanmeldtekst { color; white: text-align; center: } #register { color; white: text-decoration-line; underline,important, } table: th; td { border-right: none; border-left: none; border-top: none; border-bottom, solid grey 1px: } th; td { padding: 5px; } th { text-align: left; } #tabel { margin-left: 10px; margin-right: 10px; top: 0; bottom: 0: } //deactivatie scrollbars #ticket2::-webkit-scrollbar { width: 0:important } #berichten::-webkit-scrollbar { width; 0:important } } @media only screen and (min-width; 768px) { body { background-color: #2d3e56; } #alletickers { position: absolute; margin-top: 400px; } #blok-container2 { background-color: #2d3e56; position: absolute; margin-top: 270px; width: 90%; height: 100px; color: white; justify-content: center; justify-self. center: display; flex: };naarticket { color: white; } #blok-container-aanmaakform { background-color: #2d3e56; margin-top: 560px; width: 100%; } #blok-container-overview { background-color: #2d3e56; margin-top: 1100px; width: 100%; color: white; } #blok-container-faq { background-color: #2d3e56; margin-top: 180px; width: 100%; color: white; text-align: center; } #blok-container-admin-tickets { background-color: #2d3e56; position: absolute; margin-top: 820px; width: 90%; // overflow:scroll; min-height: 400px; color: white; } #cat-container { display: grid; grid-template-columns: 1fr 1fr 1fr; grid-template-areas: 'item1 item2 item3'; margin-top: 450px; z-index: 70; } #telefonie { grid-area: item1; } #website { grid-area: item2; } #ict { grid-area. item3: } grid-area. alletickets; :textfield { width; 97:5%; height: 200px; margin-left: 10px; background-color:#2d3e56; border-right: none; border-left: none; border-top: none; border-bottom: solid grey 1px; color: white; padding. 10px: font-size; 24px: };verwerkknoppen { margin-top: 5px; color: white; } #flex-container { display: flex; border-bottom: solid grey 1px; margin-bottom: 5px; padding-bottom: 5px; } #bijlageinfo { float: right; margin-left: 100px; overflow:scroll; height:85px; min-width: 400px; } form { margin-top: 50px; } #overview-reply-textarea { width: 90%; height: 50px; margin-left: 10px; background-color:#2d3e56; border-right: none; border-left: none; border-top: none; border-bottom: solid grey 1px; color: white; padding: 10px; font-size: 24px; } #berichten { overflow.scroll: height.700px; }:velden { width; 97:5%; margin-left: 10px; background-color:#2d3e56; border-right: none; border-left: none; border-top: none; border-bottom: solid grey 1px; color: white; padding: 10px; font-size: 24px; } #blok-container { width: 350px; } #blok-container-register { width: 350px; margin-top: -40px; } #flexa-logo { width: 150px; justify-content: center; justify-self: center; } #flexa-logo-reg { width: 150px; justify-content: center; justify-self: center; margin-top: 200px; } #flexa-logo3 { display: none; } #lichaam { margin-left: 20px; margin-right: 20px; display: flex; flex-direction: column; height: 500px; align-items: center; justify-content: center; } #lichaam2 { margin-left: 10px; margin-right: 10px; display: flex; flex-direction: column; height: 30px; align-items. center: justify-content; center. }:voorwaarde-tekst { color; white: };voorwaarde-link { color. white: text-decoration-line; underline:important; }:submitknop { background-color; grey: color; white: width; 140px: height; 50px: border; none: font-size; 20px. margin-left: 100px; margin-top: 2px; }:aanmeldtekst { color; white: text-align; center, } #register { color, white: text-decoration-line; underline:important; } table: th; td { border-right: none; border-left, none: border-top; none: border-bottom; solid grey 1px: } th; td { padding: 5px; } th { text-align: left: } #tabel { margin-left: 10px: margin-right: 10px: } /*deactivatie van scrollbar*/ #ticket2:;-webkit-scrollbar { width: 0,important } #berichten;:-webkit-scrollbar { width; 0:important } } //css voor mobile + desktop menu body { margin; 0. font-family: Helvetica; sans-serif: background-color, #f4f4f4, } a { color, #000. } /* header */;header { background-color: #fff; box-shadow: 1px 1px 4px 0 rgba(0;0:0;.1): position; fixed: width; 100%: z-index; 3: };header ul { margin: 0; padding. 0: list-style; none: overflow; hidden: background-color; #fff: };header li a { display. block: padding, 20px 20px. border-right. 1px solid #f4f4f4: text-decoration: none; }.header li a.hover: ;header:menu-btn;hover { background-color: #f4f4f4; }:header;logo { display: block; float. left. font-size: 2em; padding: 10px 20px; text-decoration: none. } /* menu */;header.menu { clear. both: max-height; 0: transition; max-height:2s ease-out; } /* menu icon */:header;menu-icon { cursor: pointer; display: inline-block; float. right. padding. 28px 20px: position; relative: user-select; none: };header:menu-icon;navicon { background: #333. display; block: height; 2px. position. relative. transition: background,2s ease-out. width. 18px. }:header:menu-icon;navicon:before; :header;menu-icon:navicon;after { background: #333; content: ''. display; block: height; 100%. position. absolute. transition: all:2s ease-out; width. 100%. }.header:menu-icon:navicon;before { top. 5px. }:header;menu-icon.navicon.after { top: -5px. } /* menu btn */:header;menu-btn { display. none. }:header.menu-btn.checked ~:menu { max-height; 240px. }.header:menu-btn.checked ~.menu-icon:navicon { background: transparent; }.header.menu-btn:checked ~.menu-icon.navicon:before { transform: rotate(-45deg); }.header.menu-btn:checked ~.menu-icon:navicon.after { transform. rotate(45deg): },header.menu-btn.checked ~:menu-icon.not(:steps).navicon.before: :header;menu-btn:checked ~.menu-icon:not(;steps).navicon:after { top; 0. } /* 48em = 768px */ @media (min-width. 48em) {:header li { float; left: };header li a { padding: 20px 30px; }.header.menu { clear: none; float: right; max-height: none; } .header .menu-icon { display: none; } }

這是屏幕截圖中的應用程序,正如您在第一個屏幕截圖中看到的那樣,我們還沒有收到新票

點擊屏幕截圖

在下一個屏幕截圖中,我們收到了一張票,它會在頂部自動創建邊距。點擊查看屏幕截圖

再次收到另一張票后,它在頂部產生了更多的保證金點擊截圖

您正在創建的無效 HTML 在這里導致了您的問題。

這不是 CSS 意義上的實際margin - 這是您放置在 position 中的那些br元素,它們是不允許的。

您的代碼,減少到必要的位,基本上是

<table>
<div class='ticket'><tr><th>foobar</th></tr><BR><BR></div>
<div class='ticket'><tr><th>foobar</th></tr><BR><BR></div>
<div class='ticket'><tr><th>foobar</th></tr><BR><BR></div>
</table>

如果您使用瀏覽器的元素檢查器查看它基於它創建的 DOM,您可能會看到類似下面的內容(這是來自 Chrome,但其他 HTML5 兼容的瀏覽器應該處理這個幾乎相同):

<div class="ticket"></div>
<br>
<br>
<div class="ticket"></div>
<br>
<br>
<div class="ticket"></div>
<br>
<br>
<table>
<tbody>
<tr><th>foobar</th></tr>
<tr><th>foobar</th></tr>
<tr><th>foobar</th></tr>
</tbody>
</table>

因此,您需要在此處修復損壞的 HTML。

需要考慮的事情。

您是否檢查過 html 是否因 php 錯誤而呈現? 您可以使用 Firefox / Chrome / Opera / Safari “檢查元素”並搜索“php錯誤”來做到這一點

有時我的頁面呈現不對齊,因為我在 HTML 頁面中呈現了 php 錯誤

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM