本文整理汇总了PHP中DataBase::Select方法的典型用法代码示例。如果您正苦于以下问题:PHP DataBase::Select方法的具体用法?PHP DataBase::Select怎么用?PHP DataBase::Select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataBase
的用法示例。
在下文中一共展示了DataBase::Select方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: PollMessage
function PollMessage()
{
include 'config/config.php';
require_once 'libs/database.php';
$db = new DataBase($db_server, $db_user, $db_password);
$db->Select($db_name);
$db->Query("SELECT * FROM messages ORDER BY id DESC LIMIT 2");
$data = $db->ReadNext();
//no message in queue - return nop
if ($data == null) {
echo "none";
return;
}
/* echo "<pre>";
print_r($data);
echo "</pre>";*/
$id = $data['id'];
$message = $data['message'];
//return the command to client
echo $message;
//delete message from queue
$db = new DataBase($db_server, $db_user, $db_password);
$db->Select($db_name);
$db->Query("DELETE FROM messages WHERE id = '{$id}';");
}
示例2: getAbsence
public function getAbsence($month, $year)
{
$userid = $_SESSION['userid'];
$sql = 'Select kind, day, year, month From absence , userabsence where abs_id = absence.id and user_id like :userid AND month LIKE :month AND year LIKE :year';
$params = array(':userid' => $userid, ':year' => $year, ':month' => $month);
$abs = parent::Select($sql, $params);
return $abs;
}
示例3: userExist
public function userExist($uid)
{
$sts = false;
$query = 'select * from user where user_id like :uid';
$params = array(':uid' => $uid);
$inf = parent::Select($query, $params);
return $inf;
}
示例4: EnqueueMessage
function EnqueueMessage($message)
{
include 'config/config.php';
require_once 'libs/database.php';
$db = new DataBase($db_server, $db_user, $db_password);
$db->Select($db_name);
$query = "INSERT INTO messages (\n\t\t\t\t\tmessage\n\t\t\t\t\t)\n\t\t\t\t\tVALUES (\n\t\t\t\t\t'{$message}'\n\t\t\t\t\t);";
$db->Query($query);
}