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


PHP JDate::toMySql方法代码示例

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


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

示例1: saveUserAppsParams

 function saveUserAppsParams($mode = '', $userId, $appId, $referId = 0, $param = null)
 {
     $db = EasyBlogHelper::db();
     $result = true;
     if (!empty($mode)) {
         $command = array();
         $todayDate = new JDate();
         if ($mode == 'insert') {
             $inserted = false;
             $uApps = EasyBlogHelper::getTable('UserApps', 'Table');
             $uApps->app_id = $appId;
             $uApps->user_id = $userId;
             $uApps->created = $todayDate->toMySql();
             $uApps->modified = $todayDate->toMySql();
             $uApps->published = true;
             if ($uApps->store()) {
                 $inserted = true;
             }
             if ($inserted) {
                 $tmpId = $uApps->id;
                 foreach ($param as $key => $val) {
                     $query = 'INSERT INTO ' . EasyBlogHelper::getHelper('SQL')->nameQuote('#__easyblog_params') . ' ' . ' ( ' . EasyBlogHelper::getHelper('SQL')->nameQuote('refer_id') . ', ' . EasyBlogHelper::getHelper('SQL')->nameQuote('param_name') . ', ' . EasyBlogHelper::getHelper('SQL')->nameQuote('param_value') . ', ' . EasyBlogHelper::getHelper('SQL')->nameQuote('param_value_type') . ', ' . EasyBlogHelper::getHelper('SQL')->nameQuote('param_type') . ', ' . EasyBlogHelper::getHelper('SQL')->nameQuote('created') . ', ' . EasyBlogHelper::getHelper('SQL')->nameQuote('modified') . ', ' . EasyBlogHelper::getHelper('SQL')->nameQuote('published') . ', ' . EasyBlogHelper::getHelper('SQL')->nameQuote('ordering') . ' ' . ' ) ' . 'VALUES ' . ' ( ' . $db->quote($tmpId) . ', ' . $db->quote($key) . ', ' . $db->quote($val) . ', ' . $db->quote('string') . ', ' . $db->quote('userapp') . ', ' . $db->quote($todayDate->toMySql()) . ', ' . $db->quote($todayDate->toMySql()) . ', ' . $db->quote('1') . ', ' . $db->quote('1') . ' ' . ' ); ';
                     $command[] = $query;
                 }
             }
         } else {
             foreach ($param as $key => $val) {
                 $query = 'UPDATE ' . EasyBlogHelper::getHelper('SQL')->nameQuote('#__easyblog_params') . ' ' . 'SET ' . EasyBlogHelper::getHelper('SQL')->nameQuote('param_value') . ' = ' . $db->quote($val) . ', ' . EasyBlogHelper::getHelper('SQL')->nameQuote('modified') . ' = ' . $db->Quote($todayDate->toMySql()) . ' ' . 'WHERE ' . EasyBlogHelper::getHelper('SQL')->nameQuote('refer_id') . ' = ' . $db->quote($referId) . ' AND ' . EasyBlogHelper::getHelper('SQL')->nameQuote('param_name') . ' = ' . $db->quote($key) . ' AND ' . EasyBlogHelper::getHelper('SQL')->nameQuote('param_type') . ' = ' . $db->quote('userapp');
                 $command[] = $query;
             }
         }
         // now we execute all the query
         if (empty($command)) {
             $result = false;
         }
         foreach ($command as $cmdQuery) {
             $db->setQuery($cmdQuery);
             if (!$db->Query()) {
                 $result = false;
             }
             if ($db->getErrorNum()) {
                 JError::raiseError(500, $db->stderr());
             }
         }
         //process ended here.
     } else {
         $result = false;
     }
     return $result;
 }
开发者ID:Tommar,项目名称:vino2,代码行数:50,代码来源:userapps.php


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