<?php

function db_connect() {
  $result = new mysqli('localhost', 'book_sc', 'heslo', 'book_sc');
  if (!$result) {
    return false;
  }
  $result->set_charset("utf8");
  $result->autocommit(TRUE);
  return $result;
}

function db_result_to_array($result) {
  $res_array = array();

  for ($count = 0; $row = $result->fetch_assoc(); $count++) {
    $res_array[$count] = $row;
  }

  return $res_array;
}

?>
