Get all events from MySQL DB
This commit is contained in:
parent
4ac73d0113
commit
9653716ff5
|
@ -1,11 +1,19 @@
|
||||||
<?php
|
<?php
|
||||||
namespace pvv\side;
|
namespace pvv\side;
|
||||||
|
use \mysqli;
|
||||||
|
require __DIR__.'/sql_config.php';
|
||||||
|
|
||||||
Class Events {
|
Class Events {
|
||||||
public function getAllEvents(){
|
public function getAllEvents(){
|
||||||
|
global $url, $user,$pass,$db;
|
||||||
$events = array();
|
$events = array();
|
||||||
$ev = new OnceEvent("Test","Now","Never","sm0xe","Here");
|
$mysqli = new mysqli($url,$user,$pass,$db);
|
||||||
$events[0] = $ev;
|
$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;
|
return $events;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?php
|
||||||
|
$url = "127.0.0.1";
|
||||||
|
$user = "user";
|
||||||
|
$pass = "password";
|
||||||
|
$db = "events";
|
||||||
|
?>
|
Loading…
Reference in New Issue