本文整理匯總了PHP中DB_Functions::getAllEvents方法的典型用法代碼示例。如果您正苦於以下問題:PHP DB_Functions::getAllEvents方法的具體用法?PHP DB_Functions::getAllEvents怎麽用?PHP DB_Functions::getAllEvents使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類DB_Functions
的用法示例。
在下文中一共展示了DB_Functions::getAllEvents方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1:
if ($tag == 'gete') {
$e = $_POST['e'];
$event = $db->getEvent($e);
if ($event) {
$response["success"] = 1;
$response["evInfo"] = $event;
echo json_encode($response);
} else {
$response["error"] = 21;
$response["error_msg"] = "event not found";
echo json_encode($response);
}
} else {
if ($tag == 'all') {
$u = $_POST['u'];
$events = $db->getAllEvents($u);
print_r($events);
if ($events) {
$response["success"] = 1;
$response["evInfo"] = $events;
echo json_encode($response);
} else {
$response["error"] = 23;
$response["error_msg"] = "no events found";
echo json_encode($response);
}
} else {
if ($tag == 'rems') {
$eno = $_POST['eno'];
$reminders = $db->getReminder($eno);
if ($reminders) {
示例2: array
<?php
require_once 'include/DB_Functions.php';
$db = new DB_Functions();
$result = $db->getAllEvents();
// json response array
$response = array("error" => FALSE);
if ($result) {
// looping through all results
// products node
$response["events"] = array();
foreach ($result as $row) {
// temp user array
$event = array();
$event["eid"] = $row["eventID"];
$event["ename"] = $row["ename"];
$event["location"] = $row["location"];
$event["description"] = $row["description"];
$event["edate"] = $row["edate"];
// push single product into final response array
array_push($response["events"], $event);
}
// success
$response["error"] = FALSE;
// echoing JSON response
echo json_encode($response);
} else {
$response["error"] = TRUE;
$response["error_msg"] = "Required parameters (name,age,email or password) is missing!";
echo json_encode($response);
}