本文整理汇总了PHP中SafeMySQL::getInd方法的典型用法代码示例。如果您正苦于以下问题:PHP SafeMySQL::getInd方法的具体用法?PHP SafeMySQL::getInd怎么用?PHP SafeMySQL::getInd使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SafeMySQL
的用法示例。
在下文中一共展示了SafeMySQL::getInd方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: json_encode
<?php
$timestart = microtime();
header('Content-type: application/json; charset=utf-8');
require_once "lib/safemysql.class.php";
require_once "pass.php";
$errormsg = "";
$response = [];
try {
$db = new SafeMySQL(['host' => $loginData['mysql_host'], 'user' => $loginData['mysql_username'], 'pass' => $loginData['mysql_password'], 'db' => $loginData['mysql_db']]);
$tableName = "tickets";
$startCurrentWeek = date("Y-m-d H:i:s", strtotime("last Monday"));
$sql = "SELECT *,DAYNAME(dtime) as day FROM {$tableName} WHERE dtime IN " . "(SELECT MAX(dtime) FROM {$tableName} " . "WHERE dtime>='{$startCurrentWeek}' " . "GROUP BY DAYNAME(dtime))";
$values = $db->getInd("day", $sql);
$response["data"] = $values;
$sql = "SELECT * FROM {$tableName} ORDER BY dtime DESC LIMIT 1";
$values = $db->getRow($sql);
$response["latest"] = $values;
} catch (Exception $e) {
$errormsg = $e->getMessage();
}
if ($errormsg == "") {
$response["status"] = "ok";
} else {
$response["status"] = "error";
$response["message"] = $errormsg;
}
$response["elapsed"] = microtime() - $timestart;
echo json_encode($response);