Convert PHP Query to Custom Query

Hi All,

Below is a PHP query I use for a quick search in the header of all of my pages. Can anyone help me convert it in to a Database Custom Query. The bit that I don’t understand is the ‘Explode and Implode’ parts.

As it is now the query returns results if a client enters a make, a model or a ref number, or a combination of any three.

Many thanks in advance
CK

    <?php
    mysql_select_db($database_grafplc, $grafplc);
    $colname_rsResults = "-1";
    $$query_rsResults = '';
    if (isset($_POST['query'])) 
    {
    $colname_rsResults = $_POST['query'];
    $split_srh = explode(" ",trim($colname_rsResults));
    $con=array();
    foreach ($split_srh as $srh)
    {
        $con[]="(make LIKE '%" . mysql_real_escape_string($srh) . "%') OR (model LIKE '%" . mysql_real_escape_string($srh) . "%') OR (ref_no_g LIKE '%" . mysql_real_escape_string($srh) . "%')";
    }
    $srh_str=implode(' OR ', $con);
    $query_rsResults="SELECT * FROM NotArchived WHERE $srh_str";
    }

    $rsResults = mysql_query($query_rsResults, $grafplc) or die(mysql_error());
    $row_rsResults = mysql_fetch_assoc($rsResults);
    $totalRows_rsResults = mysql_num_rows($rsResults);
    ?>