本文整理匯總了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);
}