jeudi 8 octobre 2015

PHP Search Engine Display's nothing

hello I am running the following code and I cannot display anything on the page after the search is run. I know the connection is correct and that the search query is being loaded, so it must be something functionally wrong

thanks for the help

<?php

        $title = $_POST['search'];
        echo $title ;

        $con = mysqli_connect("localhost", "user", "password") or die ('Could not connect, this is the error:  ' . mysql_error());
        mysqli_select_db($con,"db") or die ('Sorry could not access database at this time.  This is the error:  ' . mysql_error());   


        if(isset($_POST['search']){
        $searchq = $_POST['search'];
        $searchq = preg_replace("#[^0-9a-z]#i","",$searchq);

        $search_sql = "SELECT title FROM gamereview WHERE tags LIKE '%".$_POST['search']."%' ";
        $search_query = mysqli_query($con, $search_sql) or die("could not search");

        $count = mysqli_num_rows($query);

        if($count==0){
            $output = 'THere was no search results!';
        } else
            while ($row = myqli_fetch_array($query, MYSQLI_BOTH)){
            $title = $row['title'];
            $id = $row['id'];
            $output .= '<div>' .$id.' '.$title.'</div>'; 

            }      
       }

     echo $output;         
     mysql_close($con);

?>




Aucun commentaire:

Enregistrer un commentaire