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 :  Top 10 Best Angular Examples with Demo

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

[php]
FIND_IN_SET(needle,haystack);
[/php]

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 :

[php]
SELECT
title
FROM
posts
WHERE
FIND_IN_SET(‘php’, tags);
[/php]

READ :  PHP classes constructor and destructor Example

Laravel Query Builder:

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

[php]
$data = \DB::table(“posts”)
->select(“title”)
->whereRaw(“find_in_set(‘php’,tags)”)
->get();
[/php]

[php]
$data_search = 1;
$data = \DB::table(“popupar_post”)
->select(“popupar_post.*”)
->whereRaw(“find_in_set(‘”.$data_search.”‘,popupar_post.tags)”)
->get();
[/php]

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

Output :

[php]
Collection {#169 â–¼
#items: array:1 [â–¼
0 => {#170 â–¼
+”title”: “PHP with Laravel infinityknow.com”
}
]
[/php]

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.

READ :  Dynamic Attribute vuejs 2 Class and Style Bindings

Leave a Comment