I can't seem to place what is wrong in the code :
This is where the function takes place and execute. this is from a different file
public function search($title, $table)
    {
        $q = "SELECT * FROM $table WHERE (':title' LIKE '%".$title."%')";
        $stmt = $this->con->prepare($q);
        $stmt->execute(array(':title' => $title));
        $result = $stmt->fetchAll(PDO::FETCH_ASSOC);
        return $result;
    }
This part should check and results. different file again
 if(isset($_POST['submit'])){
     $search = $_POST['search'];   
     $min_length = 2;
    if(strlen($search) >= $min_length){
        $search = htmlspecialchars($search); 
        $results = $code->search($title, "book_info"); //the error is here*
        if(mysql_num_rows($results) > 0){ // the error is here too**
            while($results != $code->fetchAll()){
            echo "<table id=\"tablecolor\" class=\"echoname\" >";
            echo "<th><b>ID</b></th>";
            echo "<th><b>Title</b></th>";
            echo "<th><b>Author</b></th>";
            echo "<th><b>ISBN</b></th>";
            echo "<th><b>Publisher</b></th>";
            echo "<th><b>Language</b></th>";
            echo "<th><b>Genre</b></th>";
            echo "<th><b>Quantity</b></th>";
            echo "<pre>";  
                    echo "<tr>";
                    echo "<td>".$id."</td>";
                    echo "<td>".$title."</td>";
                    echo "<td>".$author."</td>";
                    echo "<td>".$isbn."</td>";
                    echo "<td>".$publisher."</td>";
                    echo "<td>".$language."</td>";
                    echo "<td>".$genre."</td>";
                    echo "<td><center>".$quantity."</center></td>";
                    echo "</tr>";    
            echo "</pre>";
            echo "</table>";
            }
        }
        else{ 
            echo "No results";
        }
    }
    else{ 
        echo "Minimum length is ".$min_length;
    }
}
This is the error when executed
*Notice: Undefined variable: title in C:\wamp\www\unitato\web\user\user-search1.php on line 16
**Warning: mysql_num_rows() expects parameter 1 to be resource, array given in C:\wamp\www\unitato\web\user\user-search1.php on line 18
I want to know how to fix this error.
 
     
     
     
    