I'm working on a simple search using php. I'm trying to display data from 2 tables using INNER JOIN and LIKE. Using the keyword I need to check if the keyword exist on one of the tables. my problem is its not showing any data.
it also shows a warning Notice: Trying to get property 'num_rows' of non-object
Thanks.
SAMPLE CODE
$keyword = $_POST['keyword'];
        if($keyword != ""){
            $sql = "SELECT * FROM history_search INNER JOIN history_subs ON history_search.keyword = history_subs.keyword WHERE keyword LIKE '%$keyword%'";
        $result = $conn->query($sql);
        if ($result->num_rows > 0) {
            // output data of each row
            while($row = $result->fetch_assoc()) {
                echo $row['keyword'];
            }
        } else {
            echo "0 results";
        }
        }
 
     
    