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.
// $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());
}
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());
}
public function like_data()
{
$query = $this->seller->table('users')
->like('name','deepak')
->orLike('age',22)
->get();
echo "<pre>";
print_r($query->getResult());
}
public function like_data()
{
$query = $this->seller->table('users')
->like('name','tailor')
->notLike('age',22)
->get();
echo "<pre>";
print_r($query->getResult());
}
public function like_data()
{
$query = $this->seller->table('users')
->orNotLike('age',21)
->get();
echo "<pre>";
print_r($query->getResult());
}
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());
}
My name is Deepak tailor as a fullstack developer. I have been in the IT industry (PHP, Nodejs, flutter) for the last 5 years. For professional and customize web development & app development, you can send inquiry on our email.
----
You can contact him at deepaktailor10@yahoo.in