本文整理汇总了PHP中database::Query方法的典型用法代码示例。如果您正苦于以下问题:PHP database::Query方法的具体用法?PHP database::Query怎么用?PHP database::Query使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类database
的用法示例。
在下文中一共展示了database::Query方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_systemuser
private function test_systemuser()
{
database::Query('SELECT * FROM ' . config::get('mysql')['dbprefix'] . 'users WHERE username = "system";', $RS);
if ($RS->ResultCount == 0) {
$this->{$errors}['system'] = 'System-Benutzer nicht gefunden.';
}
}
示例2: log
public static function log($logType, $user = false, $data1 = false)
{
$browser = new Browser();
$text = '';
$timestamp = time();
if ($user !== false) {
$userId = $user->get('id');
} else {
$userId = 0;
}
$data = '';
switch ($logType) {
case 3:
foreach ($data1 as $key => $value) {
$data .= ' ' . $key . ': ' . $value . '|';
}
break;
case 4:
$data = 'Plattform: ' . $browser->getPlatform() . ' | Browser: ' . $browser->getBrowser() . ' | Version: ' . $browser->getVersion() . ' | UserAgent: ' . $browser->getUserAgent();
break;
default:
break;
}
$text = Texter::get('log|' . $logType);
database::Query('INSERT INTO log (`type`, `text`, `data`, `userId`, `timestamp`) VALUES (' . $logType . ', :var1, :var2, :var3, :var4);', array('var1' => $text, 'var2' => $data, 'var3' => $userId, 'var4' => $timestamp));
}
示例3: getProfilePic
public static function getProfilePic()
{
$RS = database::Query('SELECT profilepic FROM users WHERE id =' . $_SESSION['beuser_id'] . ';', array());
if ($RS[0]['profilepic'] != '') {
return '<img class="profilepic" src="../data/img/_users/' . $RS[0]['profilepic'] . '">';
} else {
return '';
}
}
示例4: verifyCookie
public static function verifyCookie($cookie)
{
$parts = explode('|', $cookie);
$RS = database::Query('SELECT password FROM users WHERE id=:var1', array('var1' => $parts[0]));
$hash = hash('md5', $parts[0] . $_SERVER['REMOTE_ADDR'] . $RS[0]['password']);
if ($parts[2] == $hash && time() <= $parts[1]) {
$_SESSION['beuser_id'] = $parts[0];
$_SESSION['beuser'] = new beuser($parts[0]);
return true;
} else {
return false;
}
}
示例5: doSearch
public function doSearch()
{
if (substr($this->needle, 0, 1) == '-') {
$this->result = database::Query('SELECT id, firstname, lastname, city, phone, mail FROM users WHERE (firstname!=:var1 AND lastname!=:var1 AND street!=:var1 AND zip!=:var1 AND city!=:var1 AND country!=:var1 AND phone!=:var1 AND mail!=:var1 AND biketype!=:var1 AND reseller!=:var1) AND is_admin = 0;', array('var1' => substr($this->needle, 1)));
} else {
$this->result = database::Query('SELECT id, firstname, lastname, city, phone, mail FROM users WHERE (firstname LIKE :var1 OR lastname LIKE :var1 OR street LIKE :var1 OR zip LIKE :var1 OR city LIKE :var1 OR country LIKE :var1 OR phone LIKE :var1 OR mail LIKE :var1 OR biketype LIKE :var1 OR reseller LIKE :var1) AND is_admin = 0;', array('var1' => $this->needle));
/*
if(strpos($this->needle, '%') === false)
$this->result = database::Query('SELECT id, firstname, lastname, city, phone, mail FROM users WHERE (firstname=:var1 OR lastname=:var1 OR street=:var1 OR zip=:var1 OR city=:var1 OR country=:var1 OR phone=:var1 OR mail=:var1 OR biketype=:var1 OR reseller=:var1) AND is_admin = 0;', array('var1'=>$this->needle));
else
{
}
*/
}
}
示例6: getImages
public static function getImages($user_id)
{
$return = '';
$RS = database::Query('SELECT * FROM files WHERE user_id=:var1', array('var1' => $user_id), $stats);
if ($stats > 0) {
foreach ($RS as $file) {
$return .= '<div class="row imgrow">
<div class="col-sm-3">
<div class="img_wrap">
<img src="../data/img/_users/' . $file['filename'] . '" />
</div>
</div>
<div class="col-sm-9">
<form class="form-horizontal">
<div class="row">
<div class="col-sm-3">
<div class="form-group">
<label>ID</label>
<input type="text" class="form-control" value="' . $file['id'] . '" disabled>
</div>
</div>
<div class="col-sm-3 col-sm-offset-1">
<div class="form-group">
<label>Hochgeladen am</label>
<input type="text" class="form-control" value="' . date('d.m.Y H:i', $file['date']) . '" disabled>
</div>
</div>
</div>
<div class="form-group">
<label for="known_from">Dein Kommentar</label>
<textarea class="form-control imgcomment" data-id="' . $file['id'] . '" rows="3" disabled>' . $file['comment'] . '</textarea>
</div>
</form>
</div>
</div>';
}
//end foreach
}
//end if
return $return;
}
示例7: load
function load()
{
//get all table columns...
$DS = database::Query('SHOW COLUMNS FROM ' . $this->table, array());
//...and all data, if it's a existing dataset
if ($this->id > 0) {
$DSdata = database::Query('SELECT * FROM ' . $this->table . ' WHERE id = ' . $this->id, array())[0];
}
foreach ($DS as $dataset) {
if ($dataset['Field'] == 'id') {
continue;
}
if ($this->id > 0) {
$this->data[$dataset['Field']] = $DSdata[$dataset['Field']];
} else {
$this->data[$dataset['Field']] = '';
}
}
}
示例8: deleteImage
public function deleteImage($fileId)
{
$result = false;
if (file_exists($this->pathUserImage . $this->files[$fileId]['filename'])) {
if (unlink($this->pathUserImage . $this->files[$fileId]['filename']) === true) {
database::Query('DELETE FROM files WHERE id=:var1', array('var1' => $fileId));
$result = true;
}
}
return $result;
}
示例9: beuser
}
break;
case 'chatinit':
$return = '';
$user = new beuser($_SESSION['beuser_id']);
$RS = $user->getChat($_POST['values']['lastmsgid'], $_POST['values']['clientid']);
foreach ($RS as $key => $msg) {
$RS[$key]['time'] = date('d.m.Y H:i', $msg['time']);
}
echo json_encode(array('messages' => $RS, 'count' => count($RS)));
break;
case 'checkNewMessages':
/*
* Handler for backend/start to check for new incoming messages
*/
$RS = database::Query('SELECT * FROM messages WHERE recipient_id = 0 AND read_time = 0', array(), $stats);
if ($stats === 1) {
$user = new User($RS['sender_id']);
echo json_encode(array('msg' => Texter::get('beuser|newMessage', array($user->get('firstname', $user->get('lastname'))))));
} else {
echo json_encode(array('msg' => Texter::get('beuser|newMessages', array($stats))));
}
break;
case 'setNewPassword':
$errmsg = false;
$return['success'] = 0;
if ($_POST['values']['password_new1'] !== $_POST['values']['password_new2']) {
$errmsg = 'Die Passwörter sind nicht identisch';
} else {
$return = $this->user->createPassword($_POST['values']['password_new1'], $this->user->get('id'));
if ($return['success'] === 1) {
示例10: array
$dr = $ikra->ModifySQL('tb_tasra_personel', array('adi_soyadi', 'email'), array('İzmir SGK', 'izmir@sgk.gov.tr'), "WHERE idtb_tasra_personel = '333'");
// ModifySQL( your_table , your_table_columns , your_table_columns_new_values , your_sql_clause )
# Add Insert Object
$dr = $ikra->InsertSQL('tb_tasra_personel', array('adi_soyadi', 'email'), array('İzmir SGK', 'izmir@sgk.gov.tr'));
// InsertSQL( your_table , your_table_columns , your_table_columns_insert_values )
# Add Delete Object
$dr = $ikra->DeleteSQL('tb_tasra_personel', "WHERE idtb_tasra_personel = '324'");
// DeleteSQL( your_table , your_sql_clause )
# Add Table List Object
$table1 = $ikra->Table('tb_tasra_personel');
foreach ($table1 as $row) {
echo $row["adi_soyadi"] . '<br>';
}
// Table( only_your_table_name )
# Add Query List Object
$query1 = $ikra->Query("SELECT * FROM tb_tasra_personel");
foreach ($query1 as $row) {
echo $row["adi_soyadi"] . '<br>';
}
//single row example
echo $query1[0]["adi_soyadi"];
// Query( only_your_sql_clause )
# Add Table Object
$table1 = $ikra->Table('tb_tasra_personel');
//add table object
// Table( only_your_table_name )
# Add DBGrid with Table Object
echo $ikra->DBGrid($table1, array('adi_soyadi' => "Adı Soyadı", 'email' => "E-Posta"), 20, 0);
//customize dbgrid columns
// DBGrid( your_table_object, table_columns, row_count , active_page_index )
# Add DBGrid with Table Object
示例11: getRandomUniqueFilename
public function getRandomUniqueFilename($ext, $userid)
{
$charset = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789&()-_=+';
$filename = '';
$randStringLen = 8;
while (strlen($filename) < $randStringLen) {
$randChar = substr(str_shuffle($charset), mt_rand(0, strlen($charset)), 1);
$filename .= $randChar;
}
$RS = database::Query('SELECT * FROM files WHERE user_id = ' . $userid . ' AND filename=:var1;', array('var1' => $filename));
if (count($RS) > 0) {
$this->getRandomUniqueFilename($ext);
} else {
return $filename;
}
}