<?php
function db_connect()
{
$host = "localhost";
$user = "sed";
$pswd = "spawn";
$db = "sed";
$connection = mysqli_connect($host, $user, $pswd);
mysqli_query($connection, "SET NAMES 'utf8'");
if(!$connection || !mysqli_select_db($connection, $db))
{
return false;
}
return $connection;
}
function db_result_to_array($result)
{
$res_array = array();
$count = 0;
while($row = mysqli_fetch_array($result, $connection))
{
$res_array[$count] = $row;
$count++;
}
return $res_array;
}
function get_menu()
{
db_connect();
$query = "SELECT * FROM pages";
$result = mysqli_query($connection, $query);
$result = db_result_to_array($result);
return $result;
}
?>