- 
                    Üyelik
                    11.09.2013
                
- 
                    Yaş/Cinsiyet
                    31 / E
                
- 
                    Meslek
                    Bilgisayar Mühendisi
                
- 
                    Konum
                    İzmir
                
                - 
                    Ad Soyad
                    A** K**
                
- 
                    Mesajlar
                    1077
                
- 
                    Beğeniler
                    361 / 361
                
- 
                    Ticaret
                    33, (%100)
                
 
                Alttaki sorguyu ihtiyacınıza göre düzenleyebilirsiniz. Unutmamanız gerekir ki kelime sayısı arttıkça sorgu performansında ciddi yavaşlamalar olacaktır.
    $name ='John S Smith';
    $words=explode(" ", $name);;
    function get_all_combination($arr, $temp_string, &$collect) {
        if ($temp_string != "") 
            $collect []= $temp_string;
        for ($i=0; $i            $arrcopy = $arr;
            $elem = array_splice($arrcopy, $i, 1); // i'ninci elemanı silip, döndürür
            if (sizeof($arrcopy) > 0) {
                get_all_combination($arrcopy, $temp_string ." " . $elem[0], $collect);
            } else {
                $collect []= $temp_string. " " . $elem[0];
            }   
        }   
    }
    $collect = array();
    get_all_combination($words, "", $collect);
       /* 
        $collect içeriği 
        [0] =>  John
        [1] =>  John S
        [2] =>  John S Smith
        [3] =>  John Smith
        [4] =>  John Smith S
        [5] =>  S
        [6] =>  S John
        [7] =>  S John Smith
        [8] =>  S Smith
        [9] =>  S Smith John
        [10] =>  Smith
        [11] =>  Smith John
        [12] =>  Smith John S
        [13] =>  Smith S
        [14] =>  Smith S John 
        */
    $sql="SELECT * FROM sent WHERE 1=1 AND (customer_name = '".implode("' OR customer_name = '",$collect)."')" ;
    ?>
                        
            
                                
                                
                    
                    1 kişi bu mesajı beğendi.