我正在使用Twitter Bootstrap for UI以表格的形式显示代码中的链接但它实际上并没有显示在表格中。请找错误。
<center> <div class="well well-large"> <table>
<?php
require "config.php";
require "course_availability_file.php";
//require "database_queries.php";
//require "webcrawler.php";
$course_selected = strtolower( $_POST['coursename1']);
$available = course_availability($course_selected);
if ( $available == 0){
echo "Invalid course"."</br>";
}
else {
// echo "Valid course"."</br>";
//echo "List of training links for the course ".$course_selected ."</br>";
function retrieveFromDatabase($course_selected){
require "config.php";
$con = mysql_connect($db_host,$db_user ,$db_pass);
if (!$con){
die('Could not connect: ' . mysql_error());
}
mysql_select_db($db_name, $con);
$sql_retrieve = "SELECT DISTINCT course_link from course where course_name = '".$course_selected."' AND number < 5 ;";
$result = mysql_query( $sql_retrieve);
while($row = mysql_fetch_array($result))
{
echo '<tr>';
$link = $row['course_link'];
echo '<a href="' . $link. '"> ' .$link.' </a>'."</br>";
echo '</tr>';
}
$check_num_rows = mysql_num_rows($result);
mysql_close($con);
return $check_num_rows;
}
retrieveFromDatabase($course_selected);
}
?> </table></div> </center>
我正试图找出错误的位置。我只想在表格中显示我的链接。
答案 0 :(得分:0)
尝试将echo '<a href="' . $link. '"> ' .$link.' </a>'."</br>";
放在<td></td>
元素中。
echo '<td><a href="' . $link. '"> ' .$link.' </a>'."</br></td>";
答案 1 :(得分:0)
center
标记。相反,请margin: 0 auto;
。<td>
。td
下添加除tr
之外的任何其他标记。替换:
echo '<a href="' . $link. '"> ' .$link.' </a>'."</br>";
使用:
echo '<td><a href="' . $link. '"> ' .$link.' </a></td>';