Get all events from MySQL DB
This commit is contained in:
parent
4ac73d0113
commit
9653716ff5
@ -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;
|
||||
}
|
||||
}
|
||||
|
6
src/pvv/side/sql_config_example.php
Normal file
6
src/pvv/side/sql_config_example.php
Normal file
@ -0,0 +1,6 @@
|
||||
<?php
|
||||
$url = "127.0.0.1";
|
||||
$user = "user";
|
||||
$pass = "password";
|
||||
$db = "events";
|
||||
?>
|
Loading…
Reference in New Issue
Block a user