title: Uncaught Error: Call to undefined function mysql_select_db()
body: <p>I'm trying to fetch data from the database using Xamp Server but am getting this error.</p>
  
  <blockquote>
    <p>Fatal error: Uncaught Error: Call to undefined function
    mysql_select_db() in E:\xamp\htdocs\PoliceApp\News\fetch.php:10 Stack
    trace: #0 {main} thrown in E:\xamp\htdocs\PoliceApp\News\fetch.php on
    line 10</p>
  </blockquote>
  
  <p>Below is my <strong>php</strong> script , am still new in <strong>php</strong> please help me out on this.
  But i read all the other Posts here but it seems it's confusing to me,how can I make it right please.</p>
  
  <pre><code>&lt;?php  
  $username="root";  
  $password="namungoona";  
  $hostname = "localhost";  
  //connection string with database  
  $dbhandle = mysqli_connect($hostname, $username, $password)  
  or die("Unable to connect to MySQL");  
  echo "";  
  // connect with database  
  $selected = mysql_select_db("police",$dbhandle)  
  or die("Could not select examples");  
  //query fire  
  $result = mysql_query("select * from News;");  
  $json_response = array();  
  // fetch data in array format  
  while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {  
  // Fetch data of Fname Column and store in array of row_array
  $row_array['Headlines'] = $row['Headlines'];  
  $row_array['Details'] = $row['Details']; 
  $row_array['NewsPhoto'] = $row['NewsPhoto']; 
  
  //push the values in the array  
  array_push($json_response,$row_array);  
  }  
  //  
  echo json_encode($json_response);  
  ?&gt;  
  </code></pre>