Location: PHPKode > projects > Classifieds > classifieds/classes/Search.php
<?php

	

    session_start();

    include("../Db.php");

    include("../URLs.php");

    include("Sanitize.php");

    

    $termToSearchFor = Sanitize::clean($_POST['searchTerm']);

    

    $search_query = "SELECT 

                    SUM(((LENGTH(Body) - LENGTH(REPLACE(Body, 'term', '')))/4) +

                    ((LENGTH(Body) - LENGTH(REPLACE(Body, 'search', '')))/6))

                    AS Occurrences

                    FROM Posts 

                    GROUP BY PostId

                    ORDER BY Occurrences DESC";

    

?>
Return current item: Classifieds