2013-08-02 45 views
0

我有一個數據表顯示從MySQL數據庫中的字段,但是我不斷收到錯誤數據表警告(表ID =「我的表」):從數據源請求的未知參數「0」

的DataTable警告(表ID = '我的表'):從數據源

這裏請求的未知參數 '0' 是我的代碼:

 <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>  

是否anyo ne知道這個錯誤是什麼意思?

+0

代碼中哪裏出現錯誤? –

+0

我無法找到?我不確定? – Shane

回答

1

td的數量應該與調出datatable()時給出的數量相匹配;

快速修復(如果你不希望自定義默認的功能)將是:

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

如果你給的數據表中做任何事({/ CONFIGS /})只是完全刪除它,它應該運作良好。

相關問題