我创建了一个名为search.php的php文件。我想在表格上显示结果
我想要一个像这样的表结构。
__________________________ | |________________| | |________________| | |________________| |________|________________| |________________| |________________|
在左侧,我想要放置一张将从数据库中获取的图片,在右侧,我将放置有关学生照片的信息。
你能写一个代码吗?我们可以只用垂直线分隔照片和信息栏。(如果是的话,如何?)
答案 0 :(得分:0)
<table>
<tr>
<td rowspan="4" style="border-right: 1px solid black">
<img src"whatever.png" alt="" />img
</td>
<td>1</td>
</tr>
<tr>
<td>2</td>
</tr>
<tr>
<td>3</td>
</tr>
<tr>
<td>4</td>
</tr>
<tr>
<td rowspan="2">
</td>
<td>5</td>
</tr>
<tr>
<td>6</td>
</tr>
</table>
但确实:学习html习惯了盒装模型,即:使用div
s
答案 1 :(得分:-1)
<?php
$sql = "Select FROM * `yourtablename` where `id` = 'theidofthestudent'";
if(!mysql_query($sql)){
die(mysql_error());
} else {
echo "<table border="1px" style="text-align:center;" align="justify">";
echo "<th>Photo of student</th>";
echo "<th>Name of the student</th>";
echo "<th>Student Detials</th>";
while($row = mysql_fetch_array($sql)){
echo "<tr>";
echo "<td style="float:left;">' . $row['student_pic'] . "</td>";
echo '<td style="float:right;">' . $row['student_name'] . "</td>";
echo '<td style="float:right;">' . $row['student_details'] . "</td>";
echo "</tr>"
} echo "</table>";
}
?>