本文整理汇总了PHP中DB_Functions::getEvents方法的典型用法代码示例。如果您正苦于以下问题:PHP DB_Functions::getEvents方法的具体用法?PHP DB_Functions::getEvents怎么用?PHP DB_Functions::getEvents使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DB_Functions
的用法示例。
在下文中一共展示了DB_Functions::getEvents方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
<?php
/**
* @author Vladislavs Ignatjevs
*
*/
require_once 'include/DB_Functions.php';
$db = new DB_Functions();
$eCounter = 1;
if (isset($_POST['email'])) {
$id = $_POST['email'];
$events_raw = $db->getEvents($id);
if ($events_raw != false) {
//output error message false and number of events
$response["error"] = FALSE;
$eCount = $events_raw["eCount"];
//output events data
$response["data"] = $events_raw;
//encode
echo json_encode($response);
}
} else {
//Table missing?
$response["error"] = TRUE;
$response["error_msg"] = "Events table missing in DB? :( ";
echo json_encode($response);
}
?>
示例2:
<?php
/**
* @author Vladislavs Ignatjevs
*
*/
require_once 'include/DB_Functions.php';
$db = new DB_Functions();
if (isset($_POST['email'])) {
// receiving the post params
$user_id = $_POST['email'];
$events_raw = $db->getEvents($user_id);
if ($events_raw != false) {
//count events rows
$response["error"] = FALSE;
$events = $events_raw;
$response["sep"] = "sep";
$response["sep"] = $events;
echo json_encode($response);
} else {
//Table missing?
$response["error"] = TRUE;
$response["error_msg"] = "There are no events at the moment. Click 'add event'";
echo json_encode($response);
}
}
?>