当前位置: 首页>>代码示例>>PHP>>正文


PHP XDB::escape方法代码示例

本文整理汇总了PHP中XDB::escape方法的典型用法代码示例。如果您正苦于以下问题:PHP XDB::escape方法的具体用法?PHP XDB::escape怎么用?PHP XDB::escape使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在XDB的用法示例。


在下文中一共展示了XDB::escape方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: foreach

foreach ($tables as $table => $keys) {
    $res = XDB::query("SELECT * FROM geoloc_{$table}");
    if (!$res) {
        echo "{$table}\n";
        continue;
    }
    $all = $res->fetchAllAssoc();
    foreach ($all as &$array) {
        $from = array();
        $to = array();
        foreach ($array as $key => $value) {
            if (in_array($key, $keys)) {
                $from[] = $key . '=' . XDB::escape($value);
            }
            $valued = utf8_decode($value);
            if (is_utf8($value) && $valued != $value) {
                $to[] = $key . '=' . XDB::escape($valued);
            }
        }
        if (!empty($to)) {
            $to = implode(', ', $to);
            $from = implode(' AND ', $from);
            $sql = "UPDATE geoloc_{$table} SET {$to} WHERE {$from}";
            if (!XDB::execute($sql)) {
                echo "Echec : {$sql}\n";
            } elseif (XDB::affectedRows() == 0) {
                echo "{$sql}\n";
            }
        }
    }
}
开发者ID:Ekleog,项目名称:platal,代码行数:31,代码来源:geoloc.utf8.php

示例2: while

#!/usr/bin/php5
<?php 
require_once 'connect.db.inc.php';
$globals->debug = 0;
//do not store backtraces
$terms = XDB::iterator('SELECT `jtid`, `name` FROM `profile_job_term_enum`');
while ($term = $terms->next()) {
    $tokens = array_unique(JobTerms::tokenize($term['name']));
    if (!count($tokens)) {
        continue;
    }
    $values = array();
    foreach ($tokens as $t) {
        $values[] = '(' . XDB::escape($t) . ',' . XDB::escape($term['jtid']) . ')';
    }
    XDB::execute('INSERT IGNORE INTO `profile_job_term_search` (`search`,`jtid`) VALUES ' . implode(',', $values));
}
/* vim:set et sw=4 sts=4 ts=4: */
开发者ID:Ekleog,项目名称:platal,代码行数:18,代码来源:tokenize_job_terms.php

示例3: save

 public function save(ProfilePage $page, $field, $value)
 {
     XDB::execute("DELETE FROM  profile_mentor_term\n                            WHERE  pid = {?}", $page->pid());
     if (!count($value)) {
         return;
     }
     $mentor_term_values = array();
     foreach ($value as &$term) {
         $mentor_term_values[] = '(' . XDB::escape($page->pid()) . ', ' . XDB::escape($term['jtid']) . ')';
     }
     XDB::execute('INSERT INTO  profile_mentor_term (pid, jtid)
                        VALUES  ' . implode(',', $mentor_term_values));
 }
开发者ID:Ekleog,项目名称:platal,代码行数:13,代码来源:mentor.inc.php

示例4: token_join_query

 /**
  * Create the INNER JOIN query to restrict search to some job terms
  * @param $tokens an array of the job terms to look for (LIKE comp)
  * @param $table_alias the alias or name of the table with a jtid field to restrict
  * @param $table_field the name of the field to restrict in table_alias, usually jtid
  * @return a partial SQL query
  */
 public static function token_join_query(array $tokens, $table_alias, $table_field = 'jtid')
 {
     $joins = '';
     $i = 0;
     foreach ($tokens as $t) {
         ++$i;
         $joins .= ' INNER JOIN  profile_job_term_search AS s' . $i . ' ON(s' . $i . '.jtid = ' . $table_alias . '.' . $table_field . ' AND s' . $i . '.search LIKE ' . XDB::escape($t) . ')';
     }
     return $joins;
 }
开发者ID:Ekleog,项目名称:platal,代码行数:17,代码来源:jobterms.php

示例5: buildCondition

 public function buildCondition(PlFilter $uf)
 {
     $sub = $uf->addMentorFilter(UserFilter::MENTOR_TERM);
     return $sub . '.jtid_1 = ' . XDB::escape($this->val);
 }
开发者ID:Ekleog,项目名称:platal,代码行数:5,代码来源:conditions.inc.php


注:本文中的XDB::escape方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。