D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home2
/
technoi4
/
public_html
/
admin
/
Filename :
brandfile.php
back
Copy
<?php require_once('config.php'); $draw = $_POST['draw']; $row = $_POST['start']; $rowperpage = $_POST['length']; // Rows display per page $columnIndex = $_POST['order'][0]['column']; // Column index $columnName = $_POST['columns'][$columnIndex]['data']; // Column name $columnSortOrder = $_POST['order'][0]['dir']; // asc or desc $searchValue = mysqli_real_escape_string($conn,$_POST['search']['value']); // Search value ## Search $searchQuery = " "; if($searchValue != ''){ $searchQuery = " and (brand_name like '%".$searchValue."%' or categary_title like '%".$searchValue."%') "; } ## Total number of records without filtering $sel = mysqli_query($conn,"select count(*) as allcount from brand"); $records = mysqli_fetch_assoc($sel); $totalRecords = $records['allcount']; ## Total number of record with filtering $sel = mysqli_query($conn,"select count(*) as allcount from brand"); $records = mysqli_fetch_assoc($sel); $totalRecordwithFilter = $records['allcount']; $sql = "SELECT brand.*, categary.categary_title FROM `brand` LEFT JOIN categary ON brand.cid=categary.id".$searchQuery." order by ".$columnName." ".$columnSortOrder." limit ".$row.",".$rowperpage; $result = mysqli_query($conn, $sql); while ($row = mysqli_fetch_assoc($result)) { $data[] = array( "id"=>$row['id'], "brand_name"=>$row['brand_name'], "categary_title"=>$row['categary_title'], "brand_desc"=>$row['brand_desc'], "image"=>'<a href="img/brand/'.$row['image'].'" target="_blank"> ' . $row['image'] . '<a/> ', "edit"=>'<a href="edit_brand.php?id=' . $row["id"] . '"><i class="fas fa-edit"></i></a>', "delete"=>'<a href="brand_delete.php?id=' . $row["id"] . '" onclick="return confirm(\'Are you sure you want to Delete?\');"><i class="fa fa-trash"></i></a>' ); } $response = array( "draw" => intval($draw), "iTotalRecords" => $totalRecords, "iTotalDisplayRecords" => $totalRecordwithFilter, "aaData" => $data ); echo json_encode($response);