I have a problem. This my php code and its worked well. But how to convert this code WordPress environment based. I saw WordPress select SQL but I can’t understand that. please help me. Anyone can rewrite this code on WordPress environment.

 $connect = mysqli_connect("localhost", "root", "", "submit-form");  
      $output = '';  
      $query = "SELECT * FROM search_content WHERE Name LIKE '%".$_POST["query"]."%'";  
      $result = mysqli_query($connect, $query);  
      $output = '<ul class="list-unstyled">';  
      if(mysqli_num_rows($result) > 0)  
           while($row = mysqli_fetch_array($result))  
                $output .= '<li><strong>'.$row["Name"].',</strong> <span class="continent"> '.$row["Continent"].',</span>';  
           $output .= '<li>Country Not Found</li>';  
      $output .= '</ul>';  
      echo $output;  

Read more here: How to add php sql to wordpress environment


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Wordpress related questions and answers: