We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Help Me!! I want to do OR search!!

Excuse me.

Please help us early.

I touch phalconPHPFramework on work.

But, I can't create "And Search".

So,help us haha...

// AND検索 $keyword = mb_convert_kana($search_word, 's'); // 全角スペースを半角スペースに変換 $ary_keyword = preg_split('/[\s]+/', $keyword, -1, PREG_SPLIT_NO_EMPTY);

        foreach ($ary_keyword as $word) {
            $d_products = D_products::find(array(
                                "text_search LIKE :keyword:",
                                "bind"=>array(
                                    'keyword'=> '%' . $word . '%'
                                )
                            ));
        }


27.0k

$d_products = D_products::find(array( "text_search LIKE '%' :keyword: '%'", "bind"=>array( 'keyword'=> $word ) ));

Thanks!! jzbis!!

I am grateful for your prompt response.

$d_products = D_products::find(array( "text_search LIKE '%' :keyword: '%'", "bind"=>array( 'keyword'=> $word ) ));

Did you need to do this find in foreach ? Can you do one find with LIKES and ORS ?