<?php
function  dbConnection() {
	// Database connection
	$conn = new PDO('mysql:host='.DB_SERVER.';dbname='.DB_DATABASE, DB_USER, DB_PASS);
	return $conn;
}

function get_adm_opts() {
	$conn = dbConnection();
	$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);	
	$conn->exec("SET CHARACTER SET utf8");

  $sql = "SELECT * FROM admin_options";
  $result = $conn->query($sql);
  
  $obj = new stdClass();
  // Parse returned data
  while($row = $result->fetch(PDO::FETCH_ASSOC)) {
	  $obj->$row['option_name'] = $row['option_value'];
  }
  return $obj;
	
  $conn = NULL;
}

?>