Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

where like in laravel

$book = array('book2','book3','book5');  

$name = DB::Table('bookinfo')
        ->select('BookName', 'bookId')                
        ->Where(function ($query) use($book) {
             for ($i = 0; $i < count($book); $i++){
                $query->orwhere('bookname', 'like',  '%' . $book[$i] .'%');
             }      
        })->get();
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #laravel
ADD COMMENT
Topic
Name
1+2 =