Location: PHPKode > scripts > AFC MySQL Address Book > afc-mysql-address-book/clause.php
<?php
# ----------------------------------------------------
# ----- AFC MySQL Address Book
# ----- Version 2.2
# ----- Created on: 05/10/07
# ----- Designed by: American Financing
# ----- http://www.americanfinancing.net
# ----- For more scripts, please visit us at http://www.americanfinancing.net/free-scripts.cfm
# ----- Please feel free to modify this script for your own purpose.
# ----- ENJOY!!!
# ----- You May Modify this script, but you may not resell it in anyway.
# ----------------------------------------------------
function prepare_clause($str)
{

  $arr1 = explode("and",$str);
  foreach ($arr1 as $val1)
 {
	    $arr2 = explode("=",$val1);
	    $temp = "";
	    foreach($arr2 as $val2)
	    {

	        $val2 = trim($val2);
	        $x = strpos($val2,"'");
	        $y = strrpos($val2,"'");
	        if($x == 0 & $y == strlen($val2)-1)
	         {
	             $val2 = substr($val2,1,strlen($val2)-2);
	        }
	       $val2 = addslashes($val2);

          if(empty($temp))
         {
          	$temp = $val2;
         }
         else
         {
         $temp .= " = '".$val2."'";
         }
	 }
       $constrains[] = $temp;
 }
    $constrain = implode($constrains," and ");
    return $constrain;
}
?>
Return current item: AFC MySQL Address Book