我有一个链接到mySQL数据库的表。
我有一个包含网址的特定字段。网址正确显示在表格中,但不作为链接。
我可以将网址显示为链接吗?
该字段为“pdf_link”
这是我的代码:
<?php
$db = new mysqli("localhost", "XXXXX", "XXXXXX", "XXXXXXXX");
$query = "SELECT part_no, description, count, size, pdf_link, min, max, current FROM folding_cartons LIMIT 0,50";
$result = $db->query($query, MYSQLI_STORE_RESULT);
$o = '<table id="tablesorter-demo" class="tablesorter" border="0" cellpadding="0"
cellspacing="1"><thead><tr><th>Part Number</th><th>Description</th><th>Count</th>
<th>Size</th><th>PDF Link</th><th>Min</th><th>Max</th><th>Current</th></tr></thead>
<tbody>';
while(list($part_no, $description, $count, $size, $pdf_link, $min, $max, $current) =
$result->fetch_row()) {
$o .= '<tr><td>'.$part_no.'</td><td>'.$description.'</td><td>'.$count.'</td>
<td>'.$size.'</td><td>'.$pdf_link.'</td><td>'.$min.'</td><td>'.$max.'</td>
<td>'.$current.'</td></tr>';
}
$o .= '</tbody></table>';
echo $o;
?>
答案 0 :(得分:0)
<?php
$db = new mysqli("localhost", "XXXXX", "XXXXXX", "XXXXXXXX");
$query = "SELECT part_no, description, count, size, pdf_link, min, max, current FROM
folding_cartons LIMIT 0,50";
$result = $db->query($query, MYSQLI_STORE_RESULT);
$o = '<table id="tablesorter-demo" class="tablesorter" border="0" cellpadding="0"
cellspacing="1"><thead><tr><th>Part Number</th><th>Description</th><th>Count</th>
<th>Size</th><th>PDF Link</th><th>Min</th><th>Max</th><th>Current</th></tr></thead>
<tbody>';
while(list($part_no, $description, $count, $size, $pdf_link, $min, $max, $current) =
$result->fetch_row()) {
$o .= '<tr><td>'.$part_no.'</td><td>'.$description.'</td><td>'.$count.'</td>
<td>'.$size.'</td><td><a href="'.$pdf_link.'">'.$pdf_link.'</a></td><td>'.$min.'</td><td>'.$max.'</td>
<td>'.$current.'</td></tr>';
}
$o .= '</tbody></table>';
echo $o;
?>
答案 1 :(得分:0)
您没有使用链接标记。
'</td><td>'.$pdf_link.'</td><td>'
部分到
'</td><td><a href="'.$pdf_link.'">'.$pdf_link.'</a></td><td>'