Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/variables/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何使我的表格单元格自动适应Bootstrap3中的内容?_Php_Html_Mysql_Css_Twitter Bootstrap 3 - Fatal编程技术网

Php 如何使我的表格单元格自动适应Bootstrap3中的内容?

Php 如何使我的表格单元格自动适应Bootstrap3中的内容?,php,html,mysql,css,twitter-bootstrap-3,Php,Html,Mysql,Css,Twitter Bootstrap 3,我从Mysql数据库中获取数据并将它们填充到表中。 但是,我似乎无法使单元格自动适应内容。我试过把宽度作为桌子的属性,但我不能使它工作 非常感谢你的帮助。谢谢 以下是我到目前为止所做的 <div id="page-content-wrapper"> <div class="container-fluid"> <div class="row"> <div class="col-lg-1

我从Mysql数据库中获取数据并将它们填充到表中。 但是,我似乎无法使单元格自动适应内容。我试过把宽度作为桌子的属性,但我不能使它工作 非常感谢你的帮助。谢谢 以下是我到目前为止所做的

<div id="page-content-wrapper">
        <div class="container-fluid">
            <div class="row">
                <div class="col-lg-12">

                <table class="table table-bordered" style="width:100%">
                    <thead>
                      <tr>
                        <th><center>ID</center></th>
                        <th>Name</th>
                        <th><center>Email</center></th>
                        <th>Number</th>
                        <th>Package</th>
                        <th>Flexibility</th>
                        <th >Date</th>
                        <th>Departuring From</th>
                        <th>Departure Date</th>
                        <th>Destination</th>
                        <th>Arrival Date</th>
                        <th>Price</th>
                        <th>Consolidator</th>

                      </tr>
                    </thead>

                    <tbody>
                      <?php

                        $query = 'SELECT * FROM queries';

                        $result = mysql_query($query);

                        while ($row = mysql_fetch_array($result)) {
                            echo '<tr>';
                            echo '<td>'. $row['id'] . '</td>';
                            echo '<td>'. $row['name'] . '</td>';
                            echo '<td>'. $row['email'] . '</td>';
                            echo '<td>'. $row['contactnumber'] . '</td>';
                            echo '<td>'. $row['packagedetails'] . '</td>';
                            echo '<td>'. $row['flexibility'] . '</td>';
                            echo '<td>'. $row['datetoday'] . '</td>';
                            echo '<td>'. $row['departure'] . '</td>';
                            echo '<td>'. $row['dateofdeparture'] . '</td>';
                            echo '<td>'. $row['destination'] . '</td>';
                            echo '<td>'. $row['dateofarrival'] . '</td>';
                            echo '<td>'. $row['price'] . '</td>';
                            echo '<td>'. $row['vendor'] . '</td>';
                            echo '<td width=250>';
                            echo '<a class="btn btn-success" href="readquery.php?id='.$row['id'].'">Read</a>';
                            echo '&nbsp;';
                            echo '<a class="btn btn-success" href="updatequery.php?id='.$row['id'].'">Update</a>';
                            echo '&nbsp;';
                            echo '<a class="btn btn-danger" href="deletequery.php?id='.$row['id'].'">Delete</a>';
                            echo '</td>';
                            echo '</tr>';
                        } 
                        ?>  
                    </tbody>
                </table>

我从来没有看到过你的回声或声音。给我们一个while循环生成的HTML的输出会很有帮助。

问题不在于我的表。为了让它工作,我增加了我的表格所在容器的宽度,它工作了

请发布输出html源代码,而不是php代码,如果可以的话,请创建一个jsfiddle.net演示以及相关css。不幸的是,我不能在这里发布图像,因为它至少需要10点声誉。这是我第一次在StackOverflow上对while循环进行更改。请看一看