title: Deprecated MySql Functions
body: <p>Php is not going to promote <a href="http://www.php.net/manual/tr/function.mysql-query.php" rel="nofollow">some MySql functions</a> in upcoming days. </p>
  
  <p>There is some examples about cleaning deprecated functions in PHP manual. But for example; when i replace <code>mysql_query</code> with <code>mysqli_query</code> in code below doesn't work. Also Notepad++ treats them like functions which is defined by myself. All examples are using OOP in PHP manual. I need an example without using object orianted programing. </p>
  
  <p>Can someone tell me that how can i clean my code from deprecated mysql functions?</p>
  
  <pre><code>function db_connect_select() 
  {
          $connection = @mysql_connect(MYSQL_HOSTNAME, USERNAME_SELECT, PASSWORD);
  
          if (!$connection)
          {
            return false; 
          }
  
          if (!mysql_select_db(DATABASE))
          {
            return false; 
          }
  
          mysql_query("SET NAMES UTF8");
  
          return $connection;    
  }
  
  function db_result_to_array($result) 
  {
      $res_array = array();
  
      for ($count = 0; $row = mysql_fetch_array($result); $count++)
      {
        $res_array[$count] = $row;    
      }
      return $res_array;
  }
  
  
  function select_top_tags()
  {
      $connection = db_connect_select();
  
      $query = 'SELECT * FROM top_tags ORDER BY tag_name ASC';
  
      $result = db_result_to_array(mysql_query($query));
  
      if(mysql_ping($connection))
      {
          mysql_close($connection); 
      } 
  
      return $result; 
  }
  </code></pre>