簡體   English   中英

回顯表和html代碼

[英]echo the table and html code

我試圖在表中獲取mysql base的數據,但它給了我錯誤

function content_temp()
{
    if(isset($_GET['action']))
    {
        if($_GET['action'] == 'bans')
        {
          echo " <table class='MYTABLE'>
          <div class="positiontable">
          <tr CLASS='MYTABLE'>
                    <th CLASS='MYTABLE' height=40 width=80>User</th>
                    <th CLASS='MYTABLE' height=40 width=80>Time</th>
                    <th CLASS='MYTABLE' height=40 width=80>IP</th>
                    <th CLASS='MYTABLE' height=40 width=180>Reason</th>
                    <th CLASS='MYTABLE' height=40 width=80>Admin</th>
                  </tr>
                  </div>
                  </table> ";

        echo " <tr CLASS='MYTABLE'>
            <td CLASS='MYTABLE' height=40 width=80>$name</td>
            <td CLASS='MYTABLE' height=40 width=80>$time</td>
            <td CLASS='MYTABLE' height=40 width=80>$ip</td>
            <td CLASS='MYTABLE' height=40 width=180>$reason</td>
            <td CLASS='MYTABLE' height=40 width=80>$admin</td>
          </tr>";
        }
    }
}

( ! ) Parse error: syntax error, unexpected 'positiontable' (T_STRING), expecting ',' or ';' in C:\wamp\www\ucp\welcome.php on line 88

這是CSS

CAPTION.MYTABLE
  {
     background-color:#33b061;
     color:33b061;
     border-width:1px;
  }

  TABLE.MYTABLE
  { 
     font-family:calibri;
     font-size:12pt;
     color:#000;
     background-color:#000000;
     width:650px;
     border-color:black;
     border-width:0.4px;
     opacity: 0.6;  }

  TH.MYTABLE
  {
     font-size:12pt;
     color:white;
     background-color:#33b061;  }


  TR.MYTABLE
  {  }

  TD.MYTABLE
  {  
     font-size:12pt;
     background-color:#FFFFFF
     color:white;
     text-align:center;  }
.positiontable
{
    padding: 180px;
    position: fixed;
}

並且有什么辦法,如果它只顯示idk 10-15字段並且比它可滾動,是的,表在mainarea下,我無法選擇,復制或粘貼

echo '
    <div id="wrapper">
        <div id="toolbar" align="center">
            <div style="display: inline-block;">
                ',toolbar_temp(),'
            </div>
            <div id="upperimage">
        <div id="mainarea">' ,content_temp(), '</div>   
        </div>
    </div>';
?>

#mainarea {
    background-color: #1a1a1a;
    padding: 800px 100px 0px;
    border-top: 1px solid #000;
    border-left: 1px solid #000;
    border-right: 1px solid #000;
    border-bottom: 1px solid #000;
    margin-top: 100px;
    box-shadow: 0px 0px 14px 4px rgba(0,0,0,0.15);
    opacity: 0.6;
    width: 700px;
    filter: alpha(opacity=60); /* For IE8 and earlier */
}

function content_temp()中的<div class="positiontable">文本包含必須轉義或替換的引號(當您使用引號指定回顯時)。

例如<div class=\\"positiontable\\"><div class='positiontable'>

您在div類中使用雙引號造成了問題...因此您需要像這樣使用您的類...

<div class="positiontable"> or <div class='positiontable'>.  

嘗試這個..

function content_temp()
{
    if(isset($_GET['action']))
    {
        if($_GET['action'] == 'bans')
        {
          echo " <table class='MYTABLE'>
          <div class='positiontable'>
          <tr CLASS='MYTABLE'>
                    <th CLASS='MYTABLE' height=40 width=80>User</th>
                    <th CLASS='MYTABLE' height=40 width=80>Time</th>
                    <th CLASS='MYTABLE' height=40 width=80>IP</th>
                    <th CLASS='MYTABLE' height=40 width=180>Reason</th>
                    <th CLASS='MYTABLE' height=40 width=80>Admin</th>
                  </tr>
                  </div>
                  </table> ";

        echo " <tr CLASS='MYTABLE'>
            <td CLASS='MYTABLE' height=40 width=80>$name</td>
            <td CLASS='MYTABLE' height=40 width=80>$time</td>
            <td CLASS='MYTABLE' height=40 width=80>$ip</td>
            <td CLASS='MYTABLE' height=40 width=180>$reason</td>
            <td CLASS='MYTABLE' height=40 width=80>$admin</td>
          </tr>";
        }
    }
}

暫無
暫無

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

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