Fetch Similar data with Like | orLike | notLike | orNotLike

Deepak Tailor Image
Deepak Tailor - Oct 29 2020
Fetch Similar data with Like | orLike | notLike | orNotLike

To search the data from the database table, we use the like function. Data can be liked in many ways. Like like, orLike, notLike, orNotLike etc.

Simple like
// $this->seller = database connection
public function like_data()
{
	$query = $this->seller->table('users')
			 ->like('name','tailor')
			 ->get();
	echo "<pre>";
	print_r($query->getResult());
}

public function like_data()
{
	$query = $this->seller->table('users')
			 ->like('name','deepak')
			 ->like('age','20')
			 ->get();
	echo "<pre>";
	print_r($query->getResult());
}
Like with associative array
public function like_data()
{
	$like_args = ['name'=>'deepak','age'=>20];
	$query = $this->seller->table('users')
			 ->like($like_args)
			 ->get();
	echo "<pre>";
	print_r($query->getResult());
}
orLike function
public function like_data()
{
	$query = $this->seller->table('users')
			 ->like('name','deepak')
			 ->orLike('age',22)
			 ->get();
	echo "<pre>";
	print_r($query->getResult());
}
notLike function
public function like_data()
{
	$query = $this->seller->table('users')
			 ->like('name','tailor')
			 ->notLike('age',22)
			 ->get();
	echo "<pre>";
	print_r($query->getResult());
}
orNotLike function
public function like_data()
{
	$query = $this->seller->table('users')
			 ->orNotLike('age',21)
			 ->get();
	echo "<pre>";
	print_r($query->getResult());
}
groupBy function

The groupBy function we use to group records.

public function like_data()
{
	$query = $this->seller->table('users')
			 ->groupBy('age',20)
			 ->groupBy('age',21)
			 ->get();
	echo "<pre>";
	print_r($query->getResult());
}
Deepak Tailor Image
Deepak Tailor

My name is Deepak tailor as a fullstack developer. I have been in the IT industry for the last 5 years. For professional and customize web development, you can send inquiry on our email.
----
You can contact him at support@fulstackdev.com