Why is my datatable not working?

javascript
mysql

#1

hi i cant seem to get my datatable to work :confused:

its not going into a row like other datatables are please help

<table class="table table-bordered" id="dataTable" width="100%" cellspacing="0">
              <thead>
                <tr>
                <th>Name</th>
                <th>owner</th>
                <th>Created</th>
                <th>Minutes</th>
                <th>satoshi</th>
                <th>Claim</th>
                  </tr>
        </thead>
        <tfoot>
            <tr>
                <th>Name</th>
                <th>owner</th>
                <th>Created</th>
                <th>Minutes</th>
                <th>satoshi</th>
                <th>Claim</th>
               </tr>
        </tfoot>
        <tbody>
        <tr> 
          <?php 
        //while($res = mysql_fetch_array($result)) { // mysql_fetch_array is deprecated, we need to use mysqli_fetch_array 
        while($row = mysqli_fetch_array($result)) { 
        
            echo "<td><a href='".$row['faucet_claim']."' class='btn btn-success'>".$row['faucet_name']."</a></td>";
            echo "<td><span class='btn btn-xs btn-info'>".$row['faucet_owner']."</span></td>";  
            echo "<td><span class='btn btn-xs btn-info'>".$row['faucet_created']."</span></td>";  
            echo "<td><span class='btn btn-xs btn-info'>".$row['faucet_minutes']."</span></td>";  
            echo "<td><span class='btn btn-xs btn-info'>".$row['faucet_coin']."</span></td>";              
            echo "<td><a href='".$row['faucet_claim']."' class='btn btn-success'>claim</a></td>";
        }
        ?> 
         </tr>
        </tbody>    
        </table>

oh by the way this is what it shows


#2

I'm not entirely sure what the problem is as you don't explicitly say. However if you were hoping to put each row of the query results on a separate row in the HTML table, you'll need to put the <tr> and </tr> tags inside the while() loop, rather than outside. As you have it, you open one table row and put all the results inside it.


#3

okay i done it but it shows out off my ad now


#4

Sorry, not sure what you mean by that.


closed #5

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.