【发布时间】:2021-07-20 18:23:18
【问题描述】:
我正在尝试按照下面的屏幕截图显示一个表格。
目标是将“文件夹”图像作为可点击链接从 MySql 表中获取链接数据。 但是,当我尝试执行此操作(逐步)时,超链接位于表格之外。当我在以下内容周围添加标签时
echo '<a href="'.$row['file'].'">'.$row['file'].'</a>' ;
喜欢这个
echo "<td>" '<a href="'.$row['file'].'">'.$row['file'].'</a>' "</td>";
后面的PHP页面不会加载
// Attempt select query execution
$sql = "SELECT * FROM versioncontrol";
if($result = mysqli_query($link, $sql)){
if(mysqli_num_rows($result) > 0){
echo "<table class='table table-bordered table-striped'>";
echo "<thead>";
echo "<tr>";
echo "<th>Image Link</th>";
echo "<th>Manual Link File</th>";
echo "<th>Operating Procedure ID</th>";
echo "<th>Operating Procedure Name</th>";
echo "<th>Operating Procedure Version</th>";
echo "<th>Upload Date and Time</th>";
echo "</tr>";
echo "</thead>";
echo "<tbody>";
while($row = mysqli_fetch_array($result)){
echo "<tr>";
echo "<td>
<a href=\"sopversioncontrolKL001.php" . $record['images'] . "\" >
<img src=\"images/document.jpg" . $record['images'] . "\" height=\"30\"
/></a></td>";
echo '<a href="'.$row['file'].'">'.$row['file'].'</a>' ;
echo "<td>" . $row['SOP_ID'] . "</td>";
echo "<td>" . $row['SOP_Name'] . "</td>";
echo "<td>" . $row['SOP_Version'] . "</td>";
echo "<td>" . $row['reg_date'] . "</td>";
echo "</tr>";
}
echo "</tbody>";
echo "</table>";
// Free result set
mysqli_free_result($result);
} else{
echo "<p class='lead'><em>No records were found.</em></p>";
}
} else{
echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);
}
// Close connection
【问题讨论】:
-
将它放入
<td> -
@brombeer — 这就是他们想要做的事情