我试图在表中获取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 */
}
最佳答案
您在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>";
}
}
}
关于php - 回显表和html代码,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/35156752/