View Single Post
Old 11-13-2012, 10:28 AM  
sarettah
see you later, I'm gone
 
Industry Role:
Join Date: Oct 2002
Posts: 14,058
Code:
// This assumes that mysql has already been hooked up at the time you construct this

if(isset($_POST['search']))
{
    $searchs = array();
    if(!empty($_POST['contactname']))
    {
        // first for protection against sql injection
        $contact2use='%' . mysql_real_escape_string($_POST['contactname']) . '%';
        // then make a second version to search for
        $compressedcontact=str_replace(' ','',$contact2use);
        // then look for either version 
        $searchs[]="contactname LIKE '" . $contact2use . "' or contactname like '" . $compressedcontact . "'";
    }

Last edited by sarettah; 11-13-2012 at 10:32 AM..
sarettah is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook