All pastes #1427384 Raw Edit

Untitled

public text v1 · immutable
#1427384 ·published 2009-05-19 12:22 UTC
rendered paste body
        $qu = tep_db_query("select
                                  products_name
                            from " . TABLE_PRODUCTS_DESCRIPTION . "
                   order  by products_name asc ");


 /*
 $results = array();
while ($results[] = tep_db_fetch_array($qu));

       for ($row = 0; $row <sizeof($results); $row++)
{

   $a= $results[$row]["products_name"];
         $a= array($a);
   $a=preg_replace("%[^a-zA-Z ]%", "", $a);

     //$a =preg_replace("/\s+/", ",", $a);
  // echo $a.'<br>'  ;
 // print_r($a);
}
      */

//  foreach($results as $key => $value){

    //  print_r($value);
    //  }



     // foreach ($results as $value ) {
//$a= $value.',';
//}


     // print_r($results);




          while ( $roww = mysql_fetch_array($qu) ) {
        $search=addslashes(preg_replace("%[^a-zA-Z ]%", "", $roww['products_name']) );
                       //$search=$roww['products_name'] ;


      //  echo   $search.'<br>';



          $d= preg_split ("/\s+/", $search);
            print_r($d);
         // $d= array($roww['products_name'])   ;

          //$d= array_filter($d);
           // $d= array_merge($d);
    //$d =implode(',', $d);

           //  $d= array_unique($d);

       //    foreach ($d as $value) {
 //$a= $value.',';
//}





       //  print_r( arrayUnique($d));



        //  echo   get_soundex($in, $search).'&nbsp;'.$inp.'<br>'    ;




           // $search= $roww['products_name'] ;

    //$search = addslashes(preg_replace("%[^a-zA-Z ]%", "", $search) );
      // $searchh= $in;

   // $search = addslashes(preg_replace("%[^a-zA-Z ]%", "", $in) );

      //$stmp = get_soundex($searchh,$search).'<br>';



      //      echo 	$soundex_search;

    //    $search= $roww['products_name'] ;
   // $search = addslashes(preg_replace("%[^a-zA-Z ]%", "", $search) );












         //  $mpe = new DoubleMetaPhone($roww['products_name']);


     //   echo $roww['products_name'].'*******'.$mpe->primary.'***<br>';





         for($i=1; $i<sizeof($d); $i++){

             //  $d[$i]= array_unique(($d[$i]));
//$values = array_unique($values);


//echo  $d[$i] ;
 //  $d[$i] =addslashes(preg_replace("%[^a-zA-Z ]%", "", $d[$i]) );

                $m2 =double_metaphonee($d[$i]);
                $m2p = $m2["primary"];



               $inp=addslashes(preg_replace("%[^a-zA-Z ]%", "", $search) );
                $in=addslashes(preg_replace("%[^a-zA-Z ]%", "", $in) );
                $m1 =double_metaphonee($in);
                $m1p = $m1["primary"];




              if ($m1["primary"]==$m2["primary"] || ($m2["secondary"]!=null && $m1["secondary"]==$m2["secondary"])) {
               // if ($m1p == $m2p ) {

  echo $d[$i].'<br>';
          // $g= $d[$i];
           //$g= array ($g);
           // $g= array_merge($g);



          //$e = array_combine($g,$g);
          //print_r($g);
                }  //print_r($d).'<br>'; // echo    $d[$i].'<br>';
                }




                 }