请问任何人都可以告诉我我的PHP代码有什么问题,我试图将mysql结果显示为3列示例:
post1 post2 post3▼ post4 post5 post6这是我的代码: -
$rowsql = "SELECT * FROM status WHERE account_name='$profile_user' ORDER BY postdate DESC LIMIT 0,20";
$rowquery = mysqli_query($db_conx, $rowsql);
$rowstatusnumrows = mysqli_num_rows($rowquery);
$i=1;
$x=1;
$y=2;
$z=3;
while ($rowrow = mysqli_fetch_array($rowquery, MYSQLI_ASSOC)) {
$statusid = $rowrow["id"];
$account_name = $rowrow["account_name"];
$author = $rowrow["author"];
$postdate = $rowrow["postdate"];
$statusimg = $rowrow["img"];
$statusvideo = $rowrow["video"];
$data = $rowrow["data"];
$data = nl2br($data);
$data = str_replace("&","&",$data);
$data = stripslashes($data);
$statusDeleteButton = '';
if($author == $log_username || $account_name == $log_username ){
$statusDeleteButton .= '';
}
if($statusimg == ""){
$thereisstatusimg = "";
}
else
{
$thereisstatusimg = "<img width='260' height='130' src='".$statusimg."' />";
$thereisstatusvideo = "";
}
if($statusvideo == ""){
$thereisstatusvideo = "";
}
else
{
$thereisstatusvideo = "<iframe width='260' height='130' src='".$statusvideo."'></iframe>";
$thereisstatusimg = "";
}
$mycolumns[$i] .= "<div class='tile2' style='margin-bottom:10px; width:260px; min-height:80px; max-height:350px; background:#789600;'><div style='height:45px;'><img width='30' height='30' style='float:left; margin-top:10px; margin-bottom:10px; margin-left:10px; border-radius:15px 15px 15px 15px;' src='img/attach_1.jpg' /><div class='tile2Title' style='font-size:14px; margin-top:15px; float:left;'>".$author."</div></div>".$thereisstatusimg."".$thereisstatusvideo."<div class='tile2Desc' style='margin-top:5px; margin-bottom:5px; text-decoration: none'>".$data."</div></div>";
if($i=$x){$i=1;}
if($i=$y){$i=2;}
if($i=$z){$i=3;}
$i++;
$x+3;
$y+3;
$z+3;
}
非常感谢....
答案 0 :(得分:0)
您需要输出html代码才能制作表格。
<table name="asdf">
<tr> <td> stuff1 </td><td>stuff2</td><td>stuff3</td>
<tr>
</table>