Welcome Guest, Not a member yet? Register   Sign In
Can someone help me to edit this function to codeigniter 4
#1

PHP Code:
Please help me edit this function to codeigniter 4
public function makeQuery($minimum_price$maximum_price$brand$ram$storage){
 
$query "SELECT * FROM product WHERE product_status = '1' ";
 if(isset(
$minimum_price$maximum_price) && !empty($minimum_price) && !empty($maximum_price))
 {
 
$query .= "AND product_price BETWEEN '".$_POST["minimum_price"]."' AND '".$_POST["maximum_price"]."'";
 }
 if(isset(
$brand))
 {
 
$brand_filter implode("','"$brand);
 
$query .= "AND product_brand IN('".$brand_filter."')";
 }
 if(isset(
$ram))
 {
 
$ram_filter implode("','"$ram);
 
$query .= "AND product_ram IN('".$ram_filter."')";
 }
 if(isset(
$storage))
 {
 
$storage_filter implode("','"$storage);
 
$query .= "AND product_storage IN('".$storage_filter."')";
 }
 return 
$query;
    

thank you in advance
Reply
#2

Please read:

CodeIgniter 4 Users Guide -> Working With Databases -> Query Builder Class
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply




Theme © iAndrew 2016 - Forum software by © MyBB