gpt4 book ai didi

php - 数据表警告(表 ID = 'My Table'): Requested unknown parameter '0' from the data source

转载 作者:行者123 更新时间:2023-11-29 13:41:29 26 4
gpt4 key购买 nike

我有一个数据表来显示 MYSQL 数据库中的字段,但是我不断收到错误:

DataTables warning (table id = 'My Table'): Requested unknown parameter '0' from the data source

这是我的代码:

      <table class="table table-striped table-bordered" id="sample_1">
<thead>
<tr>
<th style="width:8px;"><input type="checkbox" class="group-checkable" data-set="#sample_1 .checkboxes" /></th>
<th>Username</th>
<th class="hidden-phone">Email</th>
<th class="hidden-phone">Points</th>
<th class="hidden-phone">Joined</th>
<th class="hidden-phone"></th>
</tr>
</thead>
<tbody>
<?php


$con = mysql_connect("localhost","cl49-XXX","XXX");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}

mysql_select_db("cl49-XXX", $con)or die( "Unable to select database");


$result=mysql_query("SELECT * FROM products ")or die('You need enter a catagory ' );

echo "<tr>"; // first row beginning
for ($i = 1; $i <= mysql_num_rows($result); $i++)
{
$row = mysql_fetch_array($result);

$prodname = $row['prodname'];
$prodID = $row['prodID'];
$catagory = $row['catagory'];

echo "<tr class='odd gradeX'>
<td><input type='checkbox' class='checkboxes' value='1'/></td>

<td class='hidden-phone'>$prodID</td>
<td class='hidden-phone'>$prodname</td>
<td class='hidden-phone'>$catagory</td>
<td class='hidden-phone'><a href='deleteproduct.php?q=$prodID'><button class='btn btn-danger'type='submit'><font color='white'>Delete</font> </a>
";


echo "</tr><tr>"; // it's time no move to next row

}
echo "</tr>"; // last row ending
?>
</tbody>
</table>

有人知道这个错误是什么意思吗?

最佳答案

td 的数量应该与调用 datatable() 时给出的数量相匹配;

快速修复(如果您不想自定义默认功能)将是:

$('#sample_1').dataTable();

如果您在数据表({/configs/})中提供了任何内容,只需将其完全删除,它应该可以正常工作。

关于php - 数据表警告(表 ID = 'My Table'): Requested unknown parameter '0' from the data source,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18021968/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com