简体   繁体   中英

Fetch data from table and display it in bootstrap table

I am fetch data from table insdie php script and displaying in table. This php script is called by button click event.

Here is the php code which does this:

        while ($row = @mysqli_fetch_array($result))
        {

            echo '<div class = "c2">        
                    <table class="table table-condensed">
                        <tbody>
                                <tr class="active">
                                      <td class="active"></td>
                                      <td class="active">'.$row['date'].'</td>
                                      <td class="success">'.$row['time'].'</td>
                                      <td class="warning">'.$row['username'].'</td>
                                      <td class="danger">'.$row['user_follower_count'].'</td>
                                      <td class="info">'.$constant.'</td>
                                      <td class="active">'.$row['tweet_text'].'</td>
                                      <td class="success">...dfd</td>
                                </tr>
                    </tbody>
                </div>
            ';

        }

However the content display looks messed.

I have used bootstrap css here

Like

在此处输入图片说明

How can I display so that all rows appears with same width in proper manner?

Content is displayed when button is clicked.

Try this:

    echo '<div class="c2"><table class="table table-condensed"><tbody>';
    while ($row = @mysqli_fetch_array($result))
        {

            echo '<tr class="active">
                                      <td class="active"></td>
                                      <td class="active">'.$row['date'].'</td>
                                      <td class="success">'.$row['time'].'</td>
                                      <td class="warning">'.$row['username'].'</td>
                                      <td class="danger">'.$row['user_follower_count'].'</td>
                                      <td class="info">'.$constant.'</td>
                                      <td class="active">'.$row['tweet_text'].'</td>
                                      <td class="success">...dfd</td>
                                </tr>';

} 
echo '</tbody></table></div>';

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM