dbConnection.php
<?php
include_once('config.php');
$dbConnection = new mysqli(DB_HOST,DB_USER,DB_PASS,DB_NAME);
  if($dbConnection->connect_errno > 0){
    die('Unable to connect to database [' . $db->connect_error . ']');
  }
  mysqli_set_charset($dbConnection, 'utf8');
?>
news.php
<?php
  require_once('dbConnection.php');
  function getNews($request){
      $sql = "select * from news";
      if (!$result = $dbConnection->query($sql)) {
          die('There was an error running the query [' . $dbConnection->error . ']');
      }
      $news = array();
      while ($row = $result->fetch_assoc() ){
        $news[]=$row;
      }
      $result->free();
      $dbConnection->close();
      return $news;
  }
  $latestNews = getNews($_REQUEST);
  echo json_encode($latestNews);
 ?>
I am getting error Undefined variable: dbConnection on line xx. Can anybody please help me to fix the issue?
 
     
     
    