當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。