dimanche 10 juin 2018

Laravel ambiguous string search

I have a problem about search. I can make basic search. I would like to make more advanced search Like search.

For example. database's table has "AAA" string at 'pn' colum. I would like to show the record when I type "aaa" search text area.

I made this below but it didn't work. Could somebody tell me what is the problem please?

   public function show(Request $request)
      {
        if (isset($request->pn))
        {



            $param =['pn' => $request->pn];
            $item =DB::select('select * from sts where pn collate utf8_unicode_ci like '%'.$pn.'%'', $param);

        } else {
           $items =DB::select('select * from sts');

        }
        return view('pn.searchshow', ['items' => $items]);
    }



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire