本文整理汇总了PHP中DatabaseManager::setQuery方法的典型用法代码示例。如果您正苦于以下问题:PHP DatabaseManager::setQuery方法的具体用法?PHP DatabaseManager::setQuery怎么用?PHP DatabaseManager::setQuery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DatabaseManager
的用法示例。
在下文中一共展示了DatabaseManager::setQuery方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
function execute()
{
if (LoginManager::isLogged() && LoginManager::isAdministrator()) {
if (isset($_POST['exercise_name']) && $_SESSION['form_enabled']) {
LoginManager::register();
LoginManager::register();
$group = sqlite_escape_string($_POST['exercise_group']);
$code = sqlite_escape_string($_POST['exercise_code']);
$name = sqlite_escape_string($_POST['exercise_name']);
$description = sqlite_escape_string($_POST['propose_description']);
$proposer = sqlite_escape_string($_POST['exercise_proposer']);
$state = 'draft';
$word_count = sqlite_escape_string($_POST['exercise_word_count']);
$licence = sqlite_escape_string($_POST['exercise_licence']);
$language = sqlite_escape_string($_POST['exercise_language']);
$media_type = sqlite_escape_string($_POST['exercise_media_type']);
$exercise_version = sqlite_escape_string($_POST['exercise_exercise_version']);
$author = sqlite_escape_string($_POST['exercise_author']);
$author_website = sqlite_escape_string($_POST['exercise_author_website']);
$author_contact = sqlite_escape_string($_POST['exercise_author_contact']);
$packager = sqlite_escape_string($_POST['exercise_packager']);
$packager_website = sqlite_escape_string($_POST['exercise_packager_website']);
$packager_contact = sqlite_escape_string($_POST['exercise_packager_contact']);
$translations = sqlite_escape_string($_POST['exercise_translations']);
$file = sqlite_escape_string($_POST['exercise_file']);
$state = 'waiting';
DatabaseManager::setQuery("INSERT INTO exercises VALUES(\n NULL,\n {$group},\n '{$proposer}',\n '{$state}',\n '{$code}',\n '{$name}',\n '{$description}',\n {$word_count},\n '{$licence}',\n '{$language}',\n '{$media_type}',\n '{$exercise_version}',\n '{$author}',\n '{$author_website}',\n '{$author_contact}',\n '{$packager}',\n '{$packager_website}',\n '{$packager_contact}',\n '{$translations}',\n '{$file}'\n );");
$this->message = "Exercise add.";
$_SESSION['form_enabled'] = false;
} else {
$_SESSION['form_enabled'] = true;
}
}
}
示例2: register
static function register()
{
if (!LoginManager::isRegistered()) {
$login = sqlite_escape_string(LoginManager::getLogin());
$email = sqlite_escape_string(LoginManager::getEmail());
DatabaseManager::setQuery("INSERT INTO users VALUES(\n '{$login}',\n '',\n '{$email}',\n 0\n );");
}
}
示例3: execute
function execute()
{
if (LoginManager::isLogged() && LoginManager::isAdministrator()) {
if (isset($_GET['remove_rights'])) {
$openid = $_GET['remove_rights'];
DatabaseManager::setQuery("UPDATE users SET admin=0 WHERE openid='{$openid}'");
} elseif (isset($_GET['add_rights'])) {
$openid = $_GET['add_rights'];
DatabaseManager::setQuery("UPDATE users SET admin=1 WHERE openid='{$openid}'");
} elseif (isset($_GET['delete'])) {
$openid = $_GET['delete'];
DatabaseManager::setQuery("DELETE FROM users WHERE openid='{$openid}'");
}
}
}
示例4: execute
function execute()
{
if (isset($_POST['propose_name']) && $_SESSION['form_enabled']) {
LoginManager::register();
$name = sqlite_escape_string($_POST['propose_name']);
$description = sqlite_escape_string($_POST['propose_description']);
$links = sqlite_escape_string($_POST['propose_links']);
$user = sqlite_escape_string(LoginManager::getLogin());
$state = 'waiting';
DatabaseManager::setQuery("INSERT INTO proposed_exercises VALUES(\n NULL,\n '{$name}',\n '{$description}',\n '{$links}',\n '{$user}',\n '{$state}',\n '',\n '',\n NULL,\n NULL,\n NULL,\n NULL,\n NULL,\n NULL,\n NULL,\n NULL,\n NULL,\n NULL,\n NULL,\n NULL\n );");
$this->message = "Exercise proposed.";
$_SESSION['form_enabled'] = false;
} else {
$_SESSION['form_enabled'] = true;
}
}
示例5: setValues
public function setValues($id, $pw, $dnr, $snr, $msg, $customer_id, $campaign_id, $delivery_receipt, $unique_msg_id)
{
$ActionResult = false;
if (160 < strlen($msg)) {
$NearestSpace = strpos($msg, ' ', 160);
$Message = substr($msg, 0, $NearestSpace);
$SecondMessage = substr($msg, $NearestSpace, strlen($msg));
} else {
$Message = $msg;
$SecondMessage = "";
}
$url = "http://smsgw1.a2p.mme.syniverse.com/sms.php?" . "id={$id}" . "&pw=" . UrlEncode($pw) . "&drep=" . $delivery_receipt . "&dnr=" . UrlEncode($dnr) . "&snr=" . UrlEncode($snr) . "&dtag=" . $unique_msg_id . "&msg=" . UrlEncode($Message);
if ($f = @fopen($url, "r")) {
$answer = fgets($f, 255);
if (substr($answer, 0, 1) == "+") {
$res = "success: {$answer}";
$ActionResult = true;
} else {
$res = "failure: {$answer}";
$ActionResult = $res;
}
} else {
$res = "failure: error opening URL";
}
if ($SecondMessage != "") {
$url = "http://smsgw1.a2p.mme.syniverse.com/sms.php?" . "id={$id}" . "&pw=" . UrlEncode($pw) . "&drep=" . $delivery_receipt . "&dnr=" . UrlEncode($dnr) . "&snr=" . UrlEncode($snr) . "&dtag=" . $unique_msg_id . "&msg=" . UrlEncode($SecondMessage);
if ($f = @fopen($url, "r")) {
$answer = fgets($f, 255);
if (substr($answer, 0, 1) == "+") {
$res = "success: {$answer}";
$ActionResult = true;
} else {
$res = "failure: {$answer}";
$ActionResult = $res;
}
} else {
$res = "failure: error opening URL";
}
}
$db = new DatabaseManager(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_DATABASE);
$SQL = 'INSERT INTO MessagingOutGoingLog(AdminCustomerID,CampaignCampaignID,MessagingMessageTypeID,DeliveryReceipt,Destination,Message,MessageKey,Result)
VALUES(' . $customer_id . ', ' . $campaign_id . ', 4, "' . $delivery_receipt . '", "' . $dnr . '", "' . mysql_real_escape_string($msg) . '", "' . $unique_msg_id . '", "' . mysql_real_escape_string($res) . '")';
$db->setQuery($SQL);
$db->Query();
return $ActionResult;
}
示例6: DeleteWod
public function DeleteWod($Id)
{
$db = new DatabaseManager(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_CUSTOM_DATABASE);
$SQL = 'DELETE FROM CustomWorkouts WHERE recid = "' . $Id . '"';
$db->setQuery($SQL);
$db->Query();
$SQL = 'DELETE FROM CustomDetails WHERE CustomWorkoutId = "' . $Id . '"';
$db->setQuery($SQL);
$db->Query();
return 'WOD has been deleted';
}
示例7: getHistory
public function getHistory()
{
$db = new DatabaseManager(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_CUSTOM_DATABASE);
$SQL = 'SELECT B.recid, B.WorkoutName, A.Attribute, L.AttributeValue, L.TimeCreated
FROM WODLog L
LEFT JOIN BenchmarkWorkouts B ON B.recid = L.ExerciseId
LEFT JOIN Attributes A ON A.recid = L.AttributeId
LEFT JOIN WorkoutTypes ET ON ET.recid = L.WODTypeId
WHERE L.MemberId = ' . $_COOKIE['UID'] . '
AND ET.WorkoutType = "Benchmark"
AND A.Attribute = "TimeToComplete"
ORDER BY TimeCreated';
$db->setQuery($SQL);
return $db->loadObjectList();
}