Projects/nettsiden-old
Projects
/
nettsiden-old
Archived
8
0
Fork 0

Get all events from MySQL DB

This commit is contained in:
Karl August Høivik 2016-08-15 20:56:24 +02:00
parent 4ac73d0113
commit 9653716ff5
2 changed files with 16 additions and 2 deletions

View File

@ -1,11 +1,19 @@
<?php
namespace pvv\side;
use \mysqli;
require __DIR__.'/sql_config.php';
Class Events {
public function getAllEvents(){
global $url, $user,$pass,$db;
$events = array();
$ev = new OnceEvent("Test","Now","Never","sm0xe","Here");
$events[0] = $ev;
$mysqli = new mysqli($url,$user,$pass,$db);
$result = $mysqli->query("SELECT name,start,stop,organiser,location FROM events");
while($row = $result->fetch_assoc()){
$ev = new OnceEvent($row['name'],$row['start'],$row['stop'],$row['organiser'],$row['location']);
array_push($events,$ev);
}
#array_sort($events);
return $events;
}
}

View File

@ -0,0 +1,6 @@
<?php
$url = "127.0.0.1";
$user = "user";
$pass = "password";
$db = "events";
?>