Getting and posting data use PHP OOP and MySQLi
No, this isn't the right way to use OOP or MySQLi.

First of all, you only provide two methods to access your wrapped mysqli instance: one to get data, one to post data. 

This hides a lot of useful and necessary functions. You can't even use prepared statements with your code, making it incredibly insecure. 

You also didn't really gain anything with your functions. With your functions, your code is:


$query = "SELECT * FROM USERS WHERE user_country='India'";
$data = $db-&gt;get_data($query);
  if($data){
    while($row=$data-&gt;fetch_assoc()){
      echo 'User Name: ':.$row["user_name"].' Age: '.$row["age"];
    }
  }



Without your functions it would be:

$query = "SELECT * FROM USERS WHERE user_country='India'";
$data = $db-&gt;query($query);
  if($data){
    while($row=$data-&gt;fetch_assoc()){
      echo 'User Name: ':.$row["user_name"].' Age: '.$row["age"];
    }
$data-&gt;free();


It's essentially the same code, making your functions unnecessary. 

If you do want to wrap mysqli - which may not actually be necessary in your case -, make sure that you:


provide all the needed functionalities.
actually improve mysqli (make it easier to use, add functionalities, ...).
keep the interface as close to that of mysqli as possible, to make it easier to use.


Instead of wrapping mysqli, it may make sense to aim for less abstract methods. For example, you may have a UserDAO, which may have methods such as selectByCountry.