css wont load but sql does

css wont load but sql does

JoebuddahJoebuddah Posts: 7Questions: 1Answers: 0
edited July 2015 in Free community support

I have both tried both jquery.dataTables with Demo_table.css and the jquery.min.js and css files neither one will load the css into the tables any idea? all the files are in the same directory as "index.php" which is the code displayed below.

  <?php
  $con=mysql_connect("localhost","wrchtnoy_user","zMziu*1V4MoL");
    if(!con){
   die("Error: ".mysql_error());
    }
   mysql_select_db("wrchtnoy_mysite",$con);
  $result = mysql_query("SELECT * FROM comments");
   ?>
  <html>
  <title>data</title>
      <script src="jquery.dataTables.min.js" type="text/javascript"></script>
      <script src="jquery.dataTables.js" type="text/javascript"</script>
  <style type="text/css">
      @import "jquery.dataTables.min.css";
      </style type="text/javascript" charset="utf-8">
  <script>
  $(document).ready(function(){
      $('#comments').dataTables();
      })

  </script>


  <body>
      <div>
          <table id="comments" class="display">
          <thead>
      <tr>
          <th>id</th>
          <th>name</th>
          <th>email</th>
      </tr>
      </thead>
      <tbody>
          <?php
          while($row = mysql_fetch_array($result)){
          ?>
          <tr>
      <td><?=$row['id']?></td>
      <td><?=$row['name']?></td>
      <td><?=$row['email']?></td>
  </tr>         

   <?php
   }
   ?>
   </tbody>
       </tbody>
       </table>
       </div>
   </body>
  </html>

Replies

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395
    <style type="text/css">
        <a href="/forums/profile/import">@import</a> "jquery.dataTables.min.css";
        </style type="text/javascript" charset="utf-8">
    

    I've no experience with @import but that doesn't look right. Check your usage with a reliable source.

  • allanallan Posts: 63,689Questions: 1Answers: 10,500 Site admin

    That's the forum up to its own tricks... An @ in a code block it tries to make into a link to a user name... I really must fix that!

    @Joebuddah - Can you link to the page please. I don't immediately see an issue with your code.

    Allan

  • JoebuddahJoebuddah Posts: 7Questions: 1Answers: 0

    josephhahn.com/breaker/test/test

  • allanallan Posts: 63,689Questions: 1Answers: 10,500 Site admin

    If you look at the console in your browser you will see something like:

    Uncaught TypeError: $(...).dataTables is not a function

    That's because it is not. As all the documentation and examples on this site show it should be $(...).dataTable() that you are using - no s.

    Allan

  • JoebuddahJoebuddah Posts: 7Questions: 1Answers: 0

    Thanks!!!!

    I feel like Barry from Office Space. I always overlook something simple.

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395

    I always overlook something simple.

    I didn't spot it, either. :-(

This discussion has been closed.