本文整理汇总了PHP中DB::getRow方法的典型用法代码示例。如果您正苦于以下问题:PHP DB::getRow方法的具体用法?PHP DB::getRow怎么用?PHP DB::getRow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DB
的用法示例。
在下文中一共展示了DB::getRow方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getOne
public static function getOne($id)
{
$data = array();
$sql = '
SELECT * FROM {{translator}}
WHERE id=' . $id . '
';
$item = DB::getRow($sql);
$sql = '
SELECT * FROM {{translator}}
WHERE parent=' . $item['id'] . '
';
$rows = DB::getALL($sql);
foreach (Translator::getLanguage() as $ii => $lang) {
if ($ii == 0) {
$data[$item['lang']] = $item;
} else {
foreach ($rows as $row) {
if ($row['lang'] == $lang['value']) {
$data[$row['lang']] = $row;
}
}
}
}
return $data;
}
示例2: getValuesNumber
public static function getValuesNumber($path)
{
$data = array();
$tree = Tree::getTreeByUrl();
$ids[] = $tree['id'];
$ids = array_merge($ids, Tree::getChilds($tree['id']));
$sql = '
SELECT DISTINCT type FROM {{data}}
WHERE path=\'' . $path . '\' AND tree IN (' . implode(',', $ids) . ')
';
$type = DB::getOne($sql);
if ($type) {
$sql = '
SELECT MAX(' . Fields::$fieldsName[$type] . ') AS maxv, MIN(' . Fields::$fieldsName[$type] . ') AS minv FROM {{data}}
WHERE path=\'' . $path . '\' AND tree IN (' . implode(',', $ids) . ')
';
$data = DB::getRow($sql);
$data['type'] = substr($type, 0, 1);
}
if ($data['maxv'] > 0) {
return $data;
} else {
return array();
}
}
示例3: login
public function login()
{
$pass = new Password($this->password);
$db = new DB();
$db->where(['email' => $this->email, 'username' => $this->username], 'AND', "OR");
$db->where(['password' => $this->password], 'AND');
$data = $db->getRow($this->table);
//_print_r($data);
if (count($data) > 0 && $pass->verifyPassword()) {
if ($n = $pass->needRehash()) {
$newHash = $pass->reHashPassword();
$db->where(['email' => $this->email, 'username' => $this->username], 'AND', "OR");
$db->where(['password' => $this->password], 'AND');
$res = $db->update($this->table, ['hash' => $newHash]);
}
/************ SET SESSION VARIABLES HERE **************/
//session_start();
$_SESSION['logged'] = TRUE;
$_SESSION['userid'] = $data->id;
$_SESSION['username'] = $data->username ? $data->username : "";
/****************** END SESSION SETTINGS **************/
return $data;
} else {
return FALSE;
}
}
示例4: indexAction
public function indexAction()
{
//get the aff_camapaign_id
$mysql['use_pixel_payout'] = 0;
//see if it has the cookie in the campaign id, then the general match, then do whatever we can to grab SOMETHING to tie this lead to
if ($_COOKIE['btclickid']) {
$click_pid = $_COOKIE['btclickid'];
} else {
//ok grab the last click from this ip_id
$mysql['ip_address'] = DB::quote($_SERVER['REMOTE_ADDR']);
$daysago = time() - 2592000;
// 30 days ago
$click_sql1 = "\tSELECT \tbt_s_clicks.click_id\n\t\t\t\t\t\t\tFROM \t\tbt_s_clicks\n\t\t\t\t\t\t\tLEFT JOIN\tbt_s_clicks_advanced USING (click_id)\n\t\t\t\t\t\t\tLEFT JOIN \tbt_s_ips USING (ip_id)\n\t\t\t\t\t\t\tWHERE \tbt_s_ips.ip_address='" . $mysql['ip_address'] . "'\n\t\t\t\t\t\t\tAND\t\tbt_s_clicks.time >= '" . $daysago . "'\n\t\t\t\t\t\t\tORDER BY \tbt_s_clicks.click_id DESC\n\t\t\t\t\t\t\tLIMIT \t\t1";
$click_row1 = DB::getRow($click_sql1);
$click_pid = base_convert($click_row1['click_id'], 10, 36);
$mysql['ad_account_id'] = DB::quote($click_row1['ad_account_id']);
}
$click = ClickModel::model()->getRow(array('conditions' => array('click_id' => base_convert($click_pid, 36, 10))));
if (!$click) {
BTApp::end();
}
if ($click->get('ad_account_id')) {
if (getArrayVar($_GET, 'amount') && is_numeric($_GET['amount'])) {
$mysql['use_pixel_payout'] = 1;
}
if ($mysql['use_pixel_payout'] == 1) {
$click->convert(0, $_GET['amount']);
} else {
$click->convert();
}
if ($click->campaign->option('pixel_type')->value) {
$sql = "select v1.var_value as v1, v2.var_value as v2, v3.var_value as v3, v4.var_value as v4 from bt_s_clicks_advanced adv\n\t\t\t\t\tleft join bt_s_variables v1 on (v1.var_id=adv.v1_id)\n\t\t\t\t\tleft join bt_s_variables v2 on (v2.var_id=adv.v2_id)\n\t\t\t\t\tleft join bt_s_variables v3 on (v3.var_id=adv.v3_id)\n\t\t\t\t\tleft join bt_s_variables v4 on (v4.var_id=adv.v4_id)\n\t\t\t\t\twhere adv.click_id=?";
$st = DB::prepare($sql);
$st->execute(array($click->id()));
$row = $st->fetch();
$data['v1'] = $row['v1'];
$data['v2'] = $row['v2'];
$data['v3'] = $row['v3'];
$data['v4'] = $row['v4'];
$data['clickid'] = $click->id();
$data['keyword'] = '';
$data['amount'] = $click->payout;
$code = replaceTrackerPlaceholders($click->campaign->option('pixel_code')->value, $data);
$code = str_replace('[[amount]]', $data['amount'], $code);
switch ($click->campaign->option('pixel_type')->value) {
case 1:
case 2:
case 3:
echo $code;
break;
case 4:
$ch = curl_init($code);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 Postback-Bot v1.0');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_exec($ch);
break;
}
}
}
}
示例5: __construct
public function __construct()
{
if ($_GET['ref']) {
$sql = 'SELECT iuser FROM {{iusers_options}} WHERE selfcode=\'' . $_GET['ref'] . '\'';
$iuser = DB::getOne($sql);
if ($iuser) {
$_SESSION['referal'] = $iuser;
}
}
$sql = 'SELECT * FROM {{tree}} WHERE parent=410 AND visible=1 ORDER BY num';
$list = DB::getAll($sql);
foreach ($list as $item) {
$fields = Fields::getFieldsByTree($item['id'], 'wide');
$item['pic'] = $fields['files_gal']['image'][0]['path'];
$multi = Fields::getMultiFields($item['id']);
foreach ($multi['color'] as $row) {
$item['list'][$row] = Funcs::$referenceId['color'][$row]['name'];
}
Run::$colors[$item['id']] = $item;
}
//print '<pre>';print_r(Run::$colors);die;
$sql = 'SELECT * FROM {{tree}} WHERE id=1';
$row = DB::getRow($sql);
Run::$socTitle = $row['seo_title'];
Run::$socDescription = $row['seo_description'];
}
示例6: getCity
public static function getCity($name)
{
$data = array();
$sql = 'SELECT * FROM {{regions}} WHERE visible=1 AND parent<>0 AND name=\'' . $name . '\'';
$data = DB::getRow($sql);
return $data;
}
示例7: getEdit
function getEdit()
{
$sql = 'SELECT * FROM {{cron}} WHERE id=' . $_GET['id'] . '';
$data = DB::getRow($sql);
$data['timing'] = explode(' ', $data['timing']);
return $data;
}
示例8: forgot
function forgot()
{
if ($_POST) {
DB::escapePost();
$sql = '
SELECT * FROM {{users}} WHERE login=\'' . $_POST['login'] . '\'
';
$return = DB::getRow($sql);
if ($return) {
$pass = Funcs::generate_password(8);
$sql = '
UPDATE {{users}}
SET pass=MD5(\'' . $pass . '\')
WHERE login=\'' . $_POST['login'] . '\'
';
DB::exec($sql);
$text = '
Здравствуйте, ' . $return["login"] . '.<br />
Ваш новый пароль ' . $pass . '.<br />
Сменить пароль Вы можете в личном кабинете.
';
$mail = new Email();
$mail->To($return['email']);
$mail->Subject('Восстановление пароля на сайте www.' . str_replace("www.", "", $_SERVER["HTTP_HOST"]));
$mail->Text($text);
$mail->Send();
}
$this->redirect('/');
} else {
View::$layout = 'empty';
View::render('site/forgot');
}
}
示例9: run
function run($path)
{
$sql = 'SELECT * FROM {{forms}} WHERE path=\'' . $path . '\'';
$form = DB::getRow($sql);
$sql = 'SELECT * FROM {{forms_fields}} WHERE forms=' . $form['id'] . ' ORDER BY num';
$fields = DB::getAll($sql);
foreach ($fields as $item) {
$item['required'] = $item['required'] == 1 ? 'required' : '';
switch ($item['type']) {
case 'string':
$text .= FormWidget::getString($item);
break;
case 'text':
$text .= FormWidget::getText($item);
break;
case 'select':
$text .= FormWidget::getSelect($item);
break;
case 'radio':
$text .= FormWidget::getRadio($item);
break;
case 'hidden':
$text .= FormWidget::getString($item);
break;
case '':
break;
}
}
return str_replace('{content}', $text, View::getWidget('form', $form));
}
示例10: getVirtual
/**
* Returns information for a virtual id.
*
* @param integer $virtual_id The virtual id for which to return
* information.
*
* @return array The virtual email information.
*/
public function getVirtual($virtual_id)
{
$sql = 'SELECT ' . $this->_getTableFields('virtuals') . ' FROM ' . $this->_params['tables']['virtuals'] . ' WHERE ' . $this->_getTableField('virtuals', 'virtual_id') . ' = ?';
Horde::log($sql, 'DEBUG');
$virtual = $this->_db->getRow($sql, array((int) $virtual_id), DB_FETCHMODE_ASSOC);
$virtual['stripped_email'] = Vilma::stripUser($virtual['virtual_email']);
return $virtual;
}
示例11: getLang
public function getLang($id)
{
$sql = '
SELECT * FROM {{lang}}
WHERE id=' . $id . '
';
return DB::getRow($sql);
}
示例12: read
/**
* Read function must return string value always to make save handler work as expected. Return empty string if there is no data to read.
* Return values from other handlers are converted to boolean expression. TRUE for success, FALSE for failure.
*
* @param string $id
* @return string
* @author Ken Mickles
*/
public static function read($id)
{
$sql = 'SELECT `data` FROM ' . SESSION_DB . '.sessions WHERE id=' . DB::s($id);
if ($row = DB::getRow($sql, __LINE__, __FILE__)) {
return (string) $row['data'];
}
return '';
}
示例13: getBindModule
function getBindModule()
{
$sql = '
SELECT * FROM {{relations}}
WHERE modul1=\'tree\' AND id1=\'' . Funcs::$uri[1] . '\'
';
return DB::getRow($sql);
}
示例14: getOne
static function getOne(array $where, $select = '*', $order = '')
{
if (!$where) {
return false;
}
self::_init();
return DB::getRow($where, static::$_table, $select, $order);
}
示例15: getVar
public static function getVar($sql, $default = '')
{
$row = DB::getRow($sql);
if (!$row) {
return $default;
}
return array_shift($row);
}