Server Address : 2a02:4780:a:760:0:37cc:13e2:3
Web Server : LiteSpeed
Uname : Linux uk-fast-web660.main-hosting.eu 5.14.0-570.55.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Oct 21 05:27:51 EDT 2025 x86_64
PHP Version : 7.4.33
<?php
function pr($arr){
echo'<pre>';
print_r($arr);
}
function prx($arr){
echo'<pre>';
print_r($arr);
die();
}
function get_safe_value($con,$str){
if($str!=''){
$str=trim($str);
return mysqli_real_escape_string($con,$str);
}
}
function get_product($conn,$limit='',$cat_id='',$product_id='',$search_str='',$sort_order='',$is_best_seller='',$sub_categories_id=''){
$sql="select product.*,categories.categories from product,categories where product.status=1";
if($cat_id!=''){
$sql.=" and product.categories_id=$cat_id";
}
if($product_id!=''){
$sql.=" and product.id=$product_id";
}
if($sub_categories_id!=''){
$sql.=" and product.sub_categories_id=$sub_categories_id";
}
if($is_best_seller!=''){
$sql.=" and product.best_seller=1 ";
}
$sql.=" and product.categories_id=categories.id ";
if($search_str!=''){
$sql.=" and (product.name like '%$search_str%' or product.description like '%$search_str%')";
}
if($sort_order!=''){
$sql.=' '.$sort_order;
}
else{
$sql.=" order by product.id desc";
}
// echo $sql;
if($limit!=''){
$sql.=" limit $limit";
}
$res=mysqli_query($conn,$sql);
$data=array();
while($row=mysqli_fetch_assoc($res)){
$data[]=$row;
}
return $data;
}
?>