Search Comma Separated values using Laravel Query FIND_IN_SET

Search Comma Separated values using Laravel Query FIND_IN_SET

In this Post We Will Explain About is Search Comma Separated values using Laravel Query FIND_IN_SET With Example and Demo.

Welcome on infinityknow.com – Examples ,The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to Laravel Search Comma Separated values – FIND_IN_SET Query

In this post we will show you Best way to implement Search comma separated value using find_in_set() in Laravel 5, hear for How to Laravel – How to search with comma separated values using Query Builder with Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

READ :  Angular Email sending using PHP

infinityknow.com in this post learn to,I will give we full source code with example of how to simple search data from simple steps to comma separated value of column tables mysql value.It is possible simple using phpmyadmin “find_in_set()” methods of MySql predefine simple function, you can use this function find_in_set() using simple whereRow() of laravel sql query builder.

using FIND_IN_SET Syntax

FIND_IN_SET(needle,haystack);

Now if we need simple to find out the posts that simple tagged into using “php”, we can use simple functions the “FIND_IN_SET” functions in following way :

SELECT 
    title
FROM
    posts
WHERE
    FIND_IN_SET('php', tags);

Laravel Query Builder:

So we can use simple “find_in_set” use functions with simple whereRaw() in Laravel.

READ :  vuejs Autocomplete textbox PHP MySQLi

$data = \DB::table("posts")
       ->select("title")
       ->whereRaw("find_in_set('php',tags)")
       ->get();

$data_search = 1;
$data = \DB::table("popupar_post")
    ->select("popupar_post.*")
    ->whereRaw("find_in_set('".$data_search."',popupar_post.tags)")
    ->get();

Now We can see output simple will be like as bellow: – for infinityknow.com

Output :

Collection {#169 ▼
  #items: array:1 [▼
    0 => {#170 ▼
      +"title": "PHP with Laravel infinityknow.com"
    }
  ]

I hope it Source code can help you….

Example

I hope you have Got php – Find inside comma separated values field Laravel 5.1 And how it works.I would Like to have FeadBack From My Blog(infinityknow.com) readers.Your Valuable FeadBack,Any Question,or any Comments abaout This Article(infinityknow.com) Are Most Always Welcome.

Add a Comment

Your email address will not be published. Required fields are marked *