ERROR for DataTables *HELP*

ERROR for DataTables *HELP*

Leon MATATALeon MATATA Posts: 2Questions: 2Answers: 0
edited November 2023 in Free community support


<div class="modal fade"  id="addadminprofile" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="exampleModalLabel">Add Product</h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
      <form action="code.php" method="POST" enctype="multipart/form-data">
        <div class="modal-body">
          <div class="form-group">
            <label>Product Name</label>
            <input type="text" name="product_name" class="form-control" placeholder="Enter Product Name" required>
            $category = "SELECT * FROM category";
            $cate_run = mysqli_query($connection, $category);
            if (mysqli_num_rows($cate_run)) {
          <div class="form-group">
            <select name="category_id" class="form-control" required>
              <option value="">Choose Category</option>
                foreach ($cate_run as $row) {
              <option value="<?php echo $row['category_id']; ?>">
                <?php echo $row['category_name']; ?>
            } else {
              echo "No Data Available"; 

          <div class="form-group">
            <label>Product Description</label>
            <input type="text" name="product_desc" class="form-control" placeholder="Enter Product Description">
          <div class="form-group">
            <label for="file">Choose Image:</label>
            <input type="file" class="form-control-file" id="file" name="product_image" required>
          <div class="form-group">
            <input type="text" name="price" class="form-control" placeholder="Enter Price" required>
          <div class="modal-footer">
            <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
            <button type="submit" name="productbtn" class="btn btn-primary">Save</button>

<div id="layoutSidenav_content">
  <div class="card shadow mb-4">
    <div class="card-header py-3">
      <div class="button-container">
        <button type="button" class="btn btn-primary mt-5" data-toggle="modal" data-target="#addadminprofile">
          Add Product
    <div class="card-body">

      <div class="table-responsive">
        $connection = mysqli_connect("localhost", "root", "", "adminpanel");
        $sql = "SELECT p.*, c.category_name FROM product p INNER JOIN category c ON p.category_id = c.category_id";
        $result = mysqli_query($connection, $sql);

        if (mysqli_num_rows($result) > 0) {
          <table id="myTable" class="table table-bordered"  width="100%" cellspacing="0%">
                <th>Product Name</th>
                <th>Product Description</th>
                <th>Product Image</th>
                <th>Uploaded Date</th>
                <th colspan=2 style="text-align:center">Action</th>
              while ($row = mysqli_fetch_assoc($result)) {
                  <td><?php echo $row['product_id']; ?></td>
                  <td><?php echo $row['product_name']; ?></td>
                  <td><?php echo $row['category_name']; ?></td>
                  <td><?php echo $row['product_desc']; ?></td>
                  <td><?php echo '<center>
image'?></td> <td><?php echo $row['price']; ?></td> <td><?php echo $row['uploaded_date']; ?></td> <td> <form action="Product_edit.php" method="POST"> <input type="hidden" name="edit_id" value="<?php echo $row['product_id']; ?>"> <button type="submit" name="edit_btn" class="btn btn-success">EDIT</button> </form> </td> <td> <form action="code.php" method="POST"> <input type="hidden" name="delete_product_id" value="<?php echo $row['product_id']; ?>"> <button type="submit" name="delete_product_btn" class="btn btn-danger">DELETE</button> </form> </td> </tr> <?php } ?> </tbody> </table> <?php } else { echo "No Records Found"; } ?> </div> </div> </div> </div> <script src=""></script> <script src=""></script> <script> $(document).ready( function () { $('#myTable').DataTable(); }); </script> <?php include('includes/scripts.php');?> </body> </html>

and this is my header

<!DOCTYPE html>
<html lang="en">
<title>HappyTalk Administration</title>
<link rel="icon" href="logo/logo.ico" type="image/x-icon">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <!-- Boxicons -->
    <link href='' rel='stylesheet'>
    <!-- My CSS -->
    <link rel="stylesheet" href="style.css">
    <link rel="stylesheet" href="styles.css">
    <link rel="stylesheet" href="" />
    <!-- jQuery -->
    <script defer src=""></script>

    <!-- Bootstrap JavaScript -->
    <script src=""></script>

How to solve this error ?

Edited by Kevin: Syntax highlighting. Details on how to highlight code using markdown can be found in this guide


  • allanallan Posts: 62,469Questions: 1Answers: 10,258 Site admin

    That suggests you are loading whatever util.js before jQuery.

    If you link to a page showing the issue I can say a bit more clearly what is going on.


Sign In or Register to comment.