0

I am using twitter Bootstrap for UI to display the links in the code in the form of table But it's not actually being displayed in the table. Please find the error.

<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>

I'm trying to find out where the error is. All I want to display my links in a table.

4

2 回答 2

0

Try putting echo '<a href="' . $link. '"> ' .$link.' </a>'."</br>"; inside a <td></td> element.

echo '<td><a href="' . $link. '"> ' .$link.' </a>'."</br></td>";

于 2012-12-03T03:42:56.403 回答
0

简单的事情:

  1. 不要使用center标签。相反,给margin: 0 auto;.
  2. 你错过了<td>

您不能添加除tdunder之外的任何其他标签tr

代替:

echo '<a href="' . $link. '"> ' .$link.' </a>'."</br>";

和:

echo '<td><a href="' . $link. '"> ' .$link.' </a></td>';
于 2012-12-03T03:51:55.353 回答