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


PHP DBObject::prepare_val_for_sql方法代码示例

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


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

示例1: findByWechatId

 static function findByWechatId($wechat_id)
 {
     global $mysqli;
     $query = 'SELECT * FROM wechat_account WHERE wechat_id=' . DBObject::prepare_val_for_sql($wechat_id);
     $result = $mysqli->query($query);
     if ($result && ($b = $result->fetch_object())) {
         $obj = new WechatAccount();
         DBObject::importQueryResultToDbObject($b, $obj);
         return $obj;
     }
     return null;
 }
开发者ID:jeffreycai,项目名称:reader,代码行数:12,代码来源:WechatAccount.class.php

示例2: findByName

 static function findByName($name)
 {
     global $mysqli;
     $query = 'SELECT * FROM block WHERE name=' . DBObject::prepare_val_for_sql($name) . ' LIMIT 1';
     $result = $mysqli->query($query);
     if ($result && ($b = $result->fetch_object())) {
         $obj = new Block();
         DBObject::importQueryResultToDbObject($b, $obj);
         return $obj;
     }
     return null;
 }
开发者ID:jeffreycai,项目名称:ct21,代码行数:12,代码来源:Block.class.php

示例3: findByName

 static function findByName($name)
 {
     global $mysqli;
     $query = 'SELECT * FROM vars WHERE name=' . DBObject::prepare_val_for_sql($name);
     $result = $mysqli->query($query);
     if ($result && ($v = $result->fetch_object())) {
         $var = new Vars();
         DBObject::importQueryResultToDbObject($v, $var);
         return $var;
     }
     return null;
 }
开发者ID:jeffreycai,项目名称:chaoliu,代码行数:12,代码来源:Vars.class.php

示例4: findByName

 public static function findByName($name)
 {
     global $mysqli;
     $query = 'SELECT * FROM site_permission WHERE name=' . DBObject::prepare_val_for_sql($name);
     $result = $mysqli->query($query);
     if ($result && ($b = $result->fetch_object())) {
         $obj = new SitePermission();
         DBObject::importQueryResultToDbObject($b, $obj);
         return $obj;
     }
     return null;
 }
开发者ID:jeffreycai,项目名称:reader,代码行数:12,代码来源:SitePermission.class.php

示例5: findByCombo

 static function findByCombo($bizid, $mid, $idx, $instance = "WechatArticle")
 {
     global $mysqli;
     $query = "SELECT * FROM wechat_article WHERE biz_id=" . DBObject::prepare_val_for_sql($bizid) . " AND mid=" . DBObject::prepare_val_for_sql($mid) . " AND idx=" . $idx . " LIMIT 1";
     $result = $mysqli->query($query);
     if ($result && ($b = $result->fetch_object())) {
         $obj = new $instance();
         DBObject::importQueryResultToDbObject($b, $obj);
         return $obj;
     }
     return null;
 }
开发者ID:jeffreycai,项目名称:reader,代码行数:12,代码来源:WechatArticle.class.php

示例6: findAllByCountryId

 static function findAllByCountryId($cid)
 {
     global $mysqli;
     $query = 'SELECT * FROM menu WHERE country_id=' . DBObject::prepare_val_for_sql($cid);
     $result = $mysqli->query($query);
     $rtn = array();
     while ($result && ($b = $result->fetch_object())) {
         $obj = new Menu();
         DBObject::importQueryResultToDbObject($b, $obj);
         $rtn[] = $obj;
     }
     return $rtn;
 }
开发者ID:jeffreycai,项目名称:ct21,代码行数:13,代码来源:Menu.class.php

示例7: findByWechatAccountId

 static function findByWechatAccountId($wid)
 {
     global $mysqli;
     $user = MySiteUser::getCurrentUser();
     $query = 'SELECT * FROM user_' . $user->getId() . '_account WHERE account_id=' . DBObject::prepare_val_for_sql($wid);
     $result = $mysqli->query($query);
     if ($result && ($b = $result->fetch_object())) {
         $obj = new UserWechatAccount();
         DBObject::importQueryResultToDbObject($b, $obj);
         return $obj;
     }
     return null;
 }
开发者ID:jeffreycai,项目名称:reader,代码行数:13,代码来源:UserWechatAccount.class.php

示例8: findByEmail

 static function findByEmail($email)
 {
     global $mysqli;
     $query = 'SELECT * FROM user WHERE email=' . DBObject::prepare_val_for_sql($email);
     $result = $mysqli->query($query);
     if ($result && ($u = $result->fetch_object())) {
         $user = new User();
         DBObject::importQueryResultToDbObject($u, $user);
         return $user;
     }
     return null;
 }
开发者ID:jeffreycai,项目名称:chaoliu,代码行数:12,代码来源:User.class.php

示例9: findByEmail

 static function findByEmail($email, $instance = 'SiteUser')
 {
     global $mysqli;
     $query = 'SELECT * FROM site_user WHERE email=' . DBObject::prepare_val_for_sql($email);
     $result = $mysqli->query($query);
     if ($result && ($b = $result->fetch_object())) {
         if (class_exists('MySiteUser')) {
             $instance = 'MySiteUser';
         }
         $obj = new $instance();
         DBObject::importQueryResultToDbObject($b, $obj);
         return $obj;
     }
     return null;
 }
开发者ID:jeffreycai,项目名称:reader,代码行数:15,代码来源:SiteUser.class.php


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