Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/76.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 我的sql表中缺少一个列_Php_Jquery_Html_Codeigniter_Datatables - Fatal编程技术网

Php 我的sql表中缺少一个列

Php 我的sql表中缺少一个列,php,jquery,html,codeigniter,datatables,Php,Jquery,Html,Codeigniter,Datatables,我从print\r()中获得了这些数据。结果如下 Array ( [0] => Customer [1] => 01/08/2016 [2] => 02/08/2016 [3] => 03/08/2016 [4] => 04/08/2016 [5] => 05/08/2016 [6] => 06/08/2016 [7] => 07/08/2016 [8] => 08/08

我从
print\r()
中获得了这些数据。结果如下

Array
(
    [0] => Customer
    [1] => 01/08/2016
    [2] => 02/08/2016
    [3] => 03/08/2016
    [4] => 04/08/2016
    [5] => 05/08/2016
    [6] => 06/08/2016
    [7] => 07/08/2016
    [8] => 08/08/2016
    [9] => 09/08/2016
    [10] => 10/08/2016
    [11] => 11/08/2016
    [12] => 12/08/2016
    [13] => 13/08/2016
    [14] => 14/08/2016
    [15] => 15/08/2016
    [16] => 16/08/2016
    [17] => 17/08/2016
    [18] => 18/08/2016
    [19] => 19/08/2016
    [20] => 20/08/2016
    [21] => 21/08/2016
    [22] => 22/08/2016
    [23] => 23/08/2016
    [24] => 24/08/2016
    [25] => 25/08/2016
    [26] => 26/08/2016
    [27] => 27/08/2016
    [28] => 28/08/2016
    [29] => 29/08/2016
    [30] => 30/08/2016
    [31] => 31/08/2016
)
我正在使用
CodeIgniter
,上面是我表格中的
字段名。然后我将用这个创建HTML表

<style>
table th:nth-child(3), td:nth-child(3) {
  display: none;
}

    .cstm{
        padding-top:25px;
        background-color:white;
    }
</style>

<table id="tbl" class="table table-bordered table-striped">
    <thead>
        <tr align="center">
            <th width="20%">No.</th>
            <?php foreach($fields as $header) { ?><th width="20%"><?=$header;?></th><?php } ?> //The array from above...
        </tr>
    </thead>
    <tbody>
        <?php 
            $no = 0;
            if($hasil != ""){
                foreach($hasil as $hsl)
                    {$no++;
        ?>
        <tr> 
            <td width="20%"><?=$no;?></td>
            <?php foreach($fields as $header => $key) { ?>
                <td data-original-title="<?=currency($hsl->Customer);?> - <?=currency($hsl->$key);?>" data-container="body" data-toggle="tooltip" data-placement="bottom" title="" class= 'ygdiganti' <?php if($hsl->$key == "") {echo "bgcolor='#FF0000'";} ?> width="20%"><?=currency($hsl->$key);?></td>
            <?php } ?>
        </tr>
        <?php
            }
                }?>
    </tbody>    
</table>   
这是截图

你们能告诉我为什么2016年8月1日失踪了吗

嗯。在我通过浏览器
ctrl+u
检查源代码之后。我能看到这部分

<th width="20%">Customer</th>
<th width="20%">01/08/2016</th>
<th width="20%">02/08/2016</th>
table th:nth-child(3), td:nth-child(3) {
  display: none;
}
客户
01/08/2016
02/08/2016
在我删除
No.
之后,我可以看到缺少的列。但是现在我错过了第二栏


我已经把它放在中间了。而且它工作正常(如果仅表格)

移动增量
$no++在foreach关闭之前。

尝试删除此部分

<th width="20%">Customer</th>
<th width="20%">01/08/2016</th>
<th width="20%">02/08/2016</th>
table th:nth-child(3), td:nth-child(3) {
  display: none;
}

请显示您的DataTables初始化代码,也许您隐藏了第二列?我只是简单地执行这个
$('#tbl')。DataTable({“scrollX”:true})
我看不出你的代码有什么问题,除了你在
thead
部分中使用
td
而不是
th
@Gyrocode.com之后,我将其更改为th,然后结果相同:(可能是您的css或js将隐藏它…只需分别回显$arr[1]。)。。。