我试图将数据库中的值填充到PHP页面中,但是,每当页面加载数据时,我都会收到此弹出错误消息。 填充的值都是正确的,但这个弹出窗口永远不会消失。非常感谢您的帮助。enter image description here
错误消息
DataTables警告(表格ID =' DataTables_Table_0'):请求的未知参数' 0'来自行的数据源......
PHP
<div class="box-content">
<table class="table table-striped table-bordered bootstrap-datatable datatable">
<thead>
<tr>
<th>Count</th>
<th>Color</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<?php
$count = 0;
foreach($query->result() as $row) {
$count++;
$delete_url = base_url()."store_item_colors/delete/".$row->id;
?>
<tr>
<td><?= $count ?></td>
<td class="center"><?= $row->color ?></td>
<td class="center">
<a class="btn btn-danger" href="<?= $delete_url ?>">
<i class="halflings-icon white trash"></i>Remove Option
</a>
</td>
</tr>
<?php
}
?>
<tr>
</tbody>
</table>
</div>
控制器
<?php
class Store_item_sizes extends MX_Controller
{
function __construct() {
parent::__construct();
}
function update($update_id) {
// only those people with an update_id for an item can get in.
if (!is_numeric($update_id)) {
redirect('site_security/not_allowed');
}
// fetch existing options for this item
$data['query'] = $this->get_where_custom('item_id', $update_id);
$data['num_rows'] = $data['query']->num_rows();
$data['headline'] = "Update Item Sizes";
$data['update_id'] = $update_id;
$data['flash'] = $this->session->flashdata('item');
$data['view_file'] = "update";
$this->load->module('templates');
$this->templates->admin($data);
}
数据库(MySQL)
列数:3 - id:PRIMARY KEY,INT - item_id:INT - 颜色:VARCHAR(120)