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


PHP getLastInsertId函数代码示例

本文整理汇总了PHP中getLastInsertId函数的典型用法代码示例。如果您正苦于以下问题:PHP getLastInsertId函数的具体用法?PHP getLastInsertId怎么用?PHP getLastInsertId使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: post

function post($sTable, $sId, $sAuthor, $sParent, $sMood, $sFileId)
{
    global $sIncPath;
    global $sModule;
    global $sHomeUrl;
    require $sIncPath . "content.inc.php";
    $sText = getEmbedCode($sModule, "player", array('id' => $sFileId, 'file' => TRUE_VAL));
    $sText = str_replace($sHomeUrl, "[ray_url]", $sText);
    $sSql = "INSERT INTO `" . $sTable . "`(`cmt_parent_id`, `cmt_object_id`, `cmt_author_id`, `cmt_text`, `cmt_mood`, `cmt_time`) VALUES('" . $sParent . "', '" . $sId . "', '" . $sAuthor . "', '" . $sText . "', '" . $sMood . "', NOW())";
    getResult($sSql);
    return getLastInsertId();
}
开发者ID:dalinhuang,项目名称:shopexts,代码行数:12,代码来源:customFunctions.inc.php

示例2: post

function post($sTable, $sId, $sAuthor, $sParent, $sMood, $sFileId)
{
    global $sIncPath;
    global $sModule;
    global $sHomeUrl;
    $sText = getEmbedCode($sModule, "player", array('id' => $sFileId));
    $sText = str_replace($sHomeUrl, "[ray_url]", $sText);
    $sSql = "INSERT INTO `" . $sTable . "`(`cmt_parent_id`, `cmt_object_id`, `cmt_author_id`, `cmt_text`, `cmt_mood`, `cmt_time`) VALUES('" . $sParent . "', '" . $sId . "', '" . $sAuthor . "', '" . $sText . "', '" . $sMood . "', NOW())";
    getResult($sSql);
    $iCommentId = getLastInsertId();
    getResult("UPDATE `" . MODULE_DB_PREFIX . "Files` SET `Description`='" . $iCommentId . "' WHERE `ID`='" . $sFileId . "'");
    return $iCommentId;
}
开发者ID:dalinhuang,项目名称:shopexts,代码行数:13,代码来源:customFunctions.inc.php

示例3: publishRecordedVideoFile

function publishRecordedVideoFile($sUserId)
{
    global $sModule;
    global $sFilesPath;
    $sPlayFile = $sFilesPath . $sUserId . VC_TEMP_FILE_NAME . VC_FLV_EXTENSION;
    if (file_exists($sPlayFile) && filesize($sPlayFile) > 0) {
        $sDBModule = DB_PREFIX . ucfirst($sModule);
        getResult("INSERT INTO `" . $sDBModule . "Files` SET `Date`='" . time() . "', `Owner`='" . $sUserId . "', `Status`='" . VC_STATUS_PENDING . "'");
        $sFileId = getLastInsertId();
        rename($sPlayFile, $sFilesPath . $sFileId);
        @rename($sFilesPath . $sUserId . VC_TEMP_FILE_NAME . VC_IMAGE_EXTENSION, $sFilesPath . $sFileId . VC_IMAGE_EXTENSION);
        @rename($sFilesPath . $sUserId . VC_TEMP_FILE_NAME . VC_THUMB_FILE_NAME . VC_IMAGE_EXTENSION, $sFilesPath . $sFileId . VC_THUMB_FILE_NAME . VC_IMAGE_EXTENSION);
        return $sFileId;
    } else {
        return false;
    }
}
开发者ID:Gotgot59,项目名称:dolphin.pro,代码行数:17,代码来源:functions.inc.php

示例4: publishRecordedFile

function publishRecordedFile($sUserId, $sTitle, $sCategory, $sTags, $sDesc)
{
    global $sModule;
    global $sFilesPathMp3;
    $sTempFile = $sFilesPathMp3 . $sUserId . TEMP_FILE_NAME;
    $sPlayFile = $sTempFile . MP3_EXTENSION;
    if (file_exists($sPlayFile) && filesize($sPlayFile) > 0) {
        $sDBModule = DB_PREFIX . ucfirst($sModule);
        $sUri = mp3_genUri($sTitle);
        $sUriPart = empty($sUri) ? "" : "`Uri`='" . $sUri . "', ";
        $sAutoApprove = getSettingValue($sModule, "autoApprove") == TRUE_VAL ? STATUS_APPROVED : STATUS_DISAPPROVED;
        getResult("INSERT INTO `" . $sDBModule . "Files` SET `Categories`='" . $sCategory . "', `Title`='" . $sTitle . "', " . $sUriPart . "`Tags`='" . $sTags . "', `Description`='" . $sDesc . "', `Date`='" . time() . "', `Owner`='" . $sUserId . "', `Status`='" . $sAutoApprove . "'");
        $sFileId = getLastInsertId();
        rename($sPlayFile, $sFilesPathMp3 . $sFileId . MP3_EXTENSION);
        @rename($sTempFile . SCREENSHOT_EXT, $sFilesPathMp3 . $sFileId . SCREENSHOT_EXT);
        return $sFileId;
    } else {
        return false;
    }
}
开发者ID:dalinhuang,项目名称:shopexts,代码行数:20,代码来源:functions.inc.php

示例5: publishRecordedFile

function publishRecordedFile($sUserId, $sTitle, $sCategory, $sTags, $sDesc)
{
    global $sModule;
    global $sFilesPathMp3;
    $sTempFile = $sFilesPathMp3 . $sUserId . TEMP_FILE_NAME;
    $sPlayFile = $sTempFile . MP3_EXTENSION;
    if (file_exists($sPlayFile) && filesize($sPlayFile) > 0) {
        $sDBModule = DB_PREFIX . ucfirst($sModule);
        $sUri = mp3_genUri($sTitle);
        $sUriPart = empty($sUri) ? "" : "`Uri`='" . $sUri . "', ";
        $sAutoApprove = getSettingValue($sModule, "autoApprove") == TRUE_VAL ? STATUS_APPROVED : STATUS_DISAPPROVED;
        getResult("INSERT INTO `" . $sDBModule . "Files` SET `Categories`='" . $sCategory . "', `Title`='" . $sTitle . "', " . $sUriPart . "`Tags`='" . $sTags . "', `Description`='" . $sDesc . "', `Date`='" . time() . "', `Owner`='" . $sUserId . "', `Status`='" . $sAutoApprove . "'");
        $sFileId = getLastInsertId();
        rename($sPlayFile, $sFilesPathMp3 . $sFileId . MP3_EXTENSION);
        $aFilesConfig = BxDolService::call('sounds', 'get_files_config');
        foreach ($aFilesConfig as $a) {
            if (isset($a['image']) && $a['image']) {
                @rename($sTempFile . $a['postfix'], $sFilesPathMp3 . $sFileId . $a['postfix']);
            }
        }
        return $sFileId;
    }
    return false;
}
开发者ID:toxalot,项目名称:dolphin.pro,代码行数:24,代码来源:functions.inc.php

示例6: getAttributes


//.........这里部分代码省略.........
                        if (is_object($decodedGet)) {
                            $decodedGet = get_object_vars($decodedGet);
                        }
                        $l = 1;
                        foreach ($decodedGet as $key => $value) {
                            $l = $l + 1;
                            $id_attributo = $key;
                            $valoreProdotti = $value;
                            $description = null;
                            $valoriAttributi = null;
                            foreach ($valoreProdotti as $key => $value) {
                                // recupero campi prodotto
                                if ($key == "description") {
                                    $nome_attributo = $value;
                                    if (is_object($nome_attributo)) {
                                        $nome_attributo = get_object_vars($nome_attributo);
                                    }
                                }
                                if ($key == "values") {
                                    $subattributes = $value;
                                    if (is_object($subattributes)) {
                                        $subattributes = get_object_vars($subattributes);
                                    }
                                }
                            }
                            // controllo esistenza dell'attributo in magento
                            $stringQuery = "select id_magento from " . $resource->getTableName('wsca_attributes') . " where id_ws='" . $id_attributo . "'";
                            $id_attributoMage = $readConnection->fetchOne($stringQuery);
                            if ($id_attributoMage == null) {
                                $model = Mage::getModel('eav/entity_setup', 'core_setup');
                                if (count($subattributes) == 0) {
                                    $input = "text";
                                    $dbInput = "testo";
                                } else {
                                    $input = "multiselect";
                                    $dbInput = "select";
                                }
                                $data = array('global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE, 'group' => 'General', 'type' => 'varchar', 'backend' => '', 'frontend' => '', 'label' => ucfirst(strtolower(replace_accents($nome_attributo))), 'input' => $input, 'unique' => false, 'required' => false, 'is_configurable' => false, 'searchable' => false, 'visible_in_advanced_search' => false, 'comparable' => false, 'filterable' => false, 'filterable_in_search' => false, 'used_for_promo_rules' => false, 'visible_on_front' => false, 'used_in_product_listing' => false, 'used_for_sort_by' => false, 'user_defined' => true);
                                $nome_attributoMage = substr("ca_" . $id_attributo, 0, 30);
                                $model->addAttribute('catalog_product', $nome_attributoMage, $data);
                                $setup = new Mage_Eav_Model_Entity_Setup('core_setup');
                                $optionTable = $setup->getTable('eav/attribute');
                                $id_attributoMage = getLastInsertId($optionTable, 'attribute_id');
                                $query = "insert into " . $resource->getTableName('wsca_attributes') . " (id_magento,id_ws,tipo) values('" . $id_attributoMage . "','" . $id_attributo . "','" . $dbInput . "')";
                                $writeConnection->query($query);
                            } else {
                                $nome_attributoMage = substr("ca_" . $id_attributo, 0, 30);
                            }
                            // se l'attributo è il supercolore utilizzo anche l'attributo colore
                            if ($nome_attributo == "Supercolore") {
                            } else {
                                foreach ($subattributes as $key => $value) {
                                    $id_valoreattributo = $key;
                                    $nome_valoreattributo = $value;
                                    // controllo esistenza opzione in magento per l'attributo in questione
                                    $stringQuery = "select id_magento from " . $resource->getTableName('wsca_subattributes') . " where id_ws='" . $id_valoreattributo . "' and id_attributes='" . $id_attributo . "'";
                                    $id_valoreattributoMage = $readConnection->fetchOne($stringQuery);
                                    if ($id_valoreattributoMage == null) {
                                        if ($nome_valoreattributo == "" || $nome_valoreattributo == null) {
                                        } else {
                                            $attribute_model = Mage::getModel('eav/entity_attribute');
                                            $attribute_options_model = Mage::getModel('eav/entity_attribute_source_table');
                                            $attribute_code = $attribute_model->getIdByCode('catalog_product', $nome_attributoMage);
                                            $attribute = $attribute_model->load($attribute_code);
                                            $attribute->setData('option', array('value' => array('option' => array(ucfirst(strtolower($nome_valoreattributo)), ucfirst(strtolower($nome_valoreattributo))))));
                                            $attribute->save();
                                            $setup = new Mage_Eav_Model_Entity_Setup('core_setup');
                                            $optionTable = $setup->getTable('eav/attribute_option');
                                            $id_valoreattributoMage = getLastInsertId($optionTable, 'option_id');
                                            $query = "insert into " . $resource->getTableName('wsca_subattributes') . " (id_magento,id_ws, id_attributes) values('" . $id_valoreattributoMage . "','" . $id_valoreattributo . "','" . $id_attributo . "')";
                                            $writeConnection->query($query);
                                        }
                                    } else {
                                        $attr = Mage::getModel('catalog/product')->getResource()->getAttribute($nome_attributoMage);
                                        if ($attr->usesSource()) {
                                            $nomeValoreAttributoMage = $attr->getSource()->getOptionText($id_valoreattributoMage);
                                            if (strtolower($nomeValoreAttributoMage) != strtolower($nome_valoreattributo)) {
                                                $attribute_model = Mage::getModel('eav/entity_attribute');
                                                $attribute_options_model = Mage::getModel('eav/entity_attribute_source_table');
                                                $attribute_code = $attribute_model->getIdByCode('catalog_product', $nome_attributoMage);
                                                $attribute = $attribute_model->load($attribute_code);
                                                // modifica della stagione su magento (nome dell'opzione)
                                                $data = array();
                                                $values = array($id_valoreattributoMage => array(0 => ucfirst(strtolower($nome_valoreattributo)), 1 => ucfirst(strtolower($nome_valoreattributo))));
                                                $data['option']['value'] = $values;
                                                $attribute->addData($data);
                                                $attribute->save();
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    return true;
}
开发者ID:technomagegithub,项目名称:colb2b,代码行数:101,代码来源:import.php

示例7: doRoom

/**
 * Actions with specified room
 */
function doRoom($sSwitch, $iUserId = 0, $iRoomId = 0, $sRoom = "")
{
    switch ($sSwitch) {
        case 'insert':
            $aCurRoom = getArray("SELECT `ID`, `Status` FROM `" . MODULE_DB_PREFIX . "Rooms` WHERE `Name`='" . $sRoom . "'");
            if (!empty($aCurRoom['ID']) && $aCurRoom['Status'] == ROOM_STATUS_DELETE) {
                getResult("UPDATE `" . MODULE_DB_PREFIX . "Rooms` SET `OwnerID`='" . $iUserId . "', `When`=UNIX_TIMESTAMP(), `Status`='" . ROOM_STATUS_NORMAL . "' WHERE `ID`='" . $aCurRoom['ID'] . "'");
                return $aCurRoom['ID'];
            } else {
                if (empty($aCurRoom['ID'])) {
                    getResult("INSERT INTO `" . MODULE_DB_PREFIX . "Rooms` (`ID`, `Name`, `OwnerID`, `When`, `Status`) VALUES ('" . $iRoomId . "', '" . addslashes($sRoom) . "', '" . $iUserId . "', UNIX_TIMESTAMP(), '" . ROOM_STATUS_NORMAL . "')");
                    return getLastInsertId();
                } else {
                    return 0;
                }
            }
            break;
        case 'delete':
            $sQuery = "UPDATE `" . MODULE_DB_PREFIX . "Rooms` SET `When`=UNIX_TIMESTAMP(), `Status`='" . ROOM_STATUS_DELETE . "' WHERE `ID` = '" . $iRoomId . "'";
            getResult($sQuery);
            break;
    }
}
开发者ID:BackupTheBerlios,项目名称:dolphin-dwbn-svn,代码行数:26,代码来源:functions.inc.php

示例8: parseXml

 case 'initFile':
     $sContents = parseXml($aXmlTemplates['result'], "msgErrorUpload", FAILED_VAL);
     $sTempFileName = $sFilesPath . $sId . TEMP_FILE_NAME;
     if (!file_exists($sTempFileName)) {
         break;
     }
     $sConvert = isset($_REQUEST['convert']) ? $_REQUEST['convert'] : TRUE_VAL;
     $bJustRename = $sConvert != TRUE_VAL;
     if (!convert($sId, $bJustRename)) {
         deleteTempFiles($sId);
         break;
     }
     $sAutoApprove = $bAdmin ? TRUE_VAL : getSettingValue($sModule, "autoApprove");
     $sUri = genUri($sTitle);
     getResult("INSERT INTO `" . MODULE_DB_PREFIX . "Files`(`CategoryId`, `Title`, `Uri`, `Tags`, `Description`, `Date`, `Owner`, `Approved`) VALUES ('" . $sCategory . "', '" . $sTitle . "', '" . $sUri . "', '" . $sTags . "', '" . $sDesc . "', '" . time() . "', '" . $sId . "', '" . $sAutoApprove . "')");
     $sFileId = getLastInsertId();
     if (!renameFile($sId, $sFileId)) {
         deleteTempFiles($sId);
         getResult("DELETE FROM `" . MODULE_DB_PREFIX . "Files` WHERE `ID`='" . $sFileId . "' LIMIT 1");
         break;
     }
     $sNewFileName = $sFileId . MP3_EXTENSION;
     deleteTempFiles($sId, true);
     parseTags($sFileId);
     if ($sId != "0") {
         getResult("UPDATE `" . MODULE_DB_PREFIX . "PlayLists` SET `Order`=`Order`+1 WHERE `Owner` = '" . $sId . "'");
         getResult("INSERT INTO `" . MODULE_DB_PREFIX . "PlayLists` VALUES('" . $sFileId . "', '" . $sId . "', '1')");
     }
     $sContents = parseXml($aXmlTemplates['result'], "", SUCCESS_VAL);
     $sContents .= parseXml($aXmlTemplates['file'], $sFileId, $sNewFileName);
     break;
开发者ID:BackupTheBerlios,项目名称:dolphin-dwbn-svn,代码行数:31,代码来源:actions.inc.php

示例9: publishRecordedVideo

function publishRecordedVideo($sUserId, $sTitle, $sCategory, $sTags, $sDesc, $aFilesConfig = array())
{
    global $sModule;
    global $sFilesPath;
    $sPlayFile = $sFilesPath . $sUserId . TEMP_FILE_NAME . FLV_EXTENSION;
    if (file_exists($sPlayFile) && filesize($sPlayFile) > 0) {
        if (!$aFilesConfig) {
            $aFilesConfig = BxDolService::call('videos', 'get_files_config');
        }
        $sDBModule = DB_PREFIX . ucfirst($sModule);
        $sUri = video_genUri($sTitle);
        $sUriPart = empty($sUri) ? "" : "`Uri`='" . $sUri . "', ";
        getResult("INSERT INTO `" . $sDBModule . "Files` SET `Categories`='" . $sCategory . "', `Title`='" . $sTitle . "', " . $sUriPart . "`Tags`='" . $sTags . "', `Description`='" . $sDesc . "', `Date`='" . time() . "', `Owner`='" . $sUserId . "', `Status`='" . STATUS_PENDING . "'");
        $sFileId = getLastInsertId();
        rename($sPlayFile, $sFilesPath . $sFileId);
        foreach ($aFilesConfig as $a) {
            if (isset($a['image']) && $a['image']) {
                @rename($sFilesPath . $sUserId . TEMP_FILE_NAME . $a['postfix'], $sFilesPath . $sFileId . $a['postfix']);
            }
        }
        return $sFileId;
    }
    return false;
}
开发者ID:lolo3-sight,项目名称:dolphin.pro,代码行数:24,代码来源:functions.inc.php

示例10: array

 $nome_valoreattributo = $value;
 // controllo esistenza opzione in magento per l'attributo in questione
 $stringQuery = "select id_magento from " . $resource->getTableName('wsca_subattributes') . " where id_ws='" . $id_valoreattributo . "' and id_attributes='" . $id_attributo . "'";
 $id_valoreattributoMage = $readConnection->fetchOne($stringQuery);
 if ($id_valoreattributoMage == null) {
     if ($nome_valoreattributo == "" || $nome_valoreattributo == null) {
     } else {
         $attribute_model = Mage::getModel('eav/entity_attribute');
         $attribute_options_model = Mage::getModel('eav/entity_attribute_source_table');
         $attribute_code = $attribute_model->getIdByCode('catalog_product', $nome_attributoMage);
         $attribute = $attribute_model->load($attribute_code);
         $attribute->setData('option', array('value' => array('option' => array(ucfirst(strtolower($nome_valoreattributo)), ucfirst(strtolower($nome_valoreattributo))))));
         $attribute->save();
         $setup = new Mage_Eav_Model_Entity_Setup('core_setup');
         $optionTable = $setup->getTable('eav/attribute_option');
         $id_valoreattributoMage = getLastInsertId($optionTable, 'option_id');
         $query = "insert into " . $resource->getTableName('wsca_subattributes') . " (id_magento,id_ws, id_attributes) values('" . $id_valoreattributoMage . "','" . $id_valoreattributo . "','" . $id_attributo . "')";
         $writeConnection->query($query);
     }
 } else {
     $attr = Mage::getModel('catalog/product')->getResource()->getAttribute($nome_attributoMage);
     if ($attr->usesSource()) {
         $nomeValoreAttributoMage = $attr->getSource()->getOptionText($id_valoreattributoMage);
         if (strtolower($nomeValoreAttributoMage) != strtolower($nome_valoreattributo)) {
             $attribute_model = Mage::getModel('eav/entity_attribute');
             $attribute_options_model = Mage::getModel('eav/entity_attribute_source_table');
             $attribute_code = $attribute_model->getIdByCode('catalog_product', $nome_attributoMage);
             $attribute = $attribute_model->load($attribute_code);
             // modifica della stagione su magento (nome dell'opzione)
             $data = array();
             $values = array($id_valoreattributoMage => array(0 => ucfirst(strtolower($nome_valoreattributo)), 1 => ucfirst(strtolower($nome_valoreattributo))));
开发者ID:technomagegithub,项目名称:colb2b,代码行数:31,代码来源:getAttributes.php

示例11: move_uploaded_file

         move_uploaded_file($_FILES['Filedata']['tmp_name'], $sFilePath);
         @chmod($sFilePath, 0644);
     }
     break;
 case 'initFile':
     $sFilePath = $sFilesPath . $sSndId . "to" . $sRspId . ".temp";
     $sContents = parseXml($aXmlTemplates['result'], "msgErrorUpload", FAILED_VAL);
     $sContactId = getContactId($sSndId, $sRspId);
     if (!file_exists($sFilePath) || filesize($sFilePath) == 0) {
         break;
     }
     if (empty($sContactId)) {
         $sFileName = time();
     } else {
         getResult("INSERT INTO `" . MODULE_DB_PREFIX . "Messages`(`ContactID`, `Message`, `Type`, `When`) VALUES('" . $sContactId . "', '" . $sMessage . "', 'file', '" . time() . "')");
         $sFileName = getLastInsertId();
     }
     $sFileName .= ".file";
     if (!@rename($sFilePath, $sFilesPath . $sFileName)) {
         break;
     }
     $sContents = parseXml($aXmlTemplates['result'], $sFileName, SUCCESS_VAL);
     break;
 case 'removeFile':
     $sId = str_replace(".file", "", $sId);
     removeFile($sId);
     break;
     /**
      * >>> ACTIONS FOR INVITE <<<
      * Check for pending messages for given user
      */
开发者ID:BackupTheBerlios,项目名称:dolphin-dwbn-svn,代码行数:31,代码来源:actions.inc.php

示例12: publishRecordedVideo

function publishRecordedVideo($sUserId, $sTitle, $sCategory, $sTags, $sDesc)
{
    global $sModule;
    global $sFilesPath;
    $sPlayFile = $sFilesPath . $sUserId . TEMP_FILE_NAME . FLV_EXTENSION;
    if (file_exists($sPlayFile) && filesize($sPlayFile) > 0) {
        $sDBModule = DB_PREFIX . ucfirst($sModule);
        $sUri = video_genUri($sTitle);
        $sUriPart = empty($sUri) ? "" : "`Uri`='" . $sUri . "', ";
        getResult("INSERT INTO `" . $sDBModule . "Files` SET `Categories`='" . $sCategory . "', `Title`='" . $sTitle . "', " . $sUriPart . "`Tags`='" . $sTags . "', `Description`='" . $sDesc . "', `Date`='" . time() . "', `Owner`='" . $sUserId . "', `Status`='" . STATUS_PENDING . "'");
        $sFileId = getLastInsertId();
        rename($sPlayFile, $sFilesPath . $sFileId);
        @rename($sFilesPath . $sUserId . TEMP_FILE_NAME . IMAGE_EXTENSION, $sFilesPath . $sFileId . IMAGE_EXTENSION);
        @rename($sFilesPath . $sUserId . TEMP_FILE_NAME . THUMB_FILE_NAME . IMAGE_EXTENSION, $sFilesPath . $sFileId . THUMB_FILE_NAME . IMAGE_EXTENSION);
        return $sFileId;
    } else {
        return false;
    }
}
开发者ID:dalinhuang,项目名称:shopexts,代码行数:19,代码来源:functions.inc.php

示例13: getResult

     /**
      * Create new Board
      * param - boardId
      * param - title
      */
 //-------------------------------------//
 //--- Actions for LITE Version Only ---//
 //-------------------------------------//
 /**
  * Create new Board
  * param - boardId
  * param - title
  */
 case 'create':
     getResult("INSERT INTO `" . MODULE_DB_PREFIX . "Boards`(`UserID`, `Title`, `Track`) VALUES('" . $sUserId . "', '" . $sTitle . "', '" . time() . "')");
     $iBoardId = (int) getLastInsertId();
     if (!empty($iBoardId)) {
         $sContents = parseXml($aXmlTemplates['result'], $iBoardId, SUCCESS_VAL);
     } else {
         $sContents = parseXml($aXmlTemplates['result'], 'msgErrorDB', FAILED_VAL);
     }
     break;
     /**
      * Destroy specified Board.
      * param - boardId
      */
 /**
  * Destroy specified Board.
  * param - boardId
  */
 case 'destroy':
开发者ID:BackupTheBerlios,项目名称:dolphin-dwbn-svn,代码行数:31,代码来源:actions.inc.php

示例14: array

     $j = $j + 1;
 }
 $id_attributo = "000001";
 // controllo esistenza opzione in magento per l'attributo in questione
 $stringQuery = "select id_magento from " . $resource->getTableName('wsca_subattributes') . " where id_ws='" . $stringaIdAttributo . "' and id_attributes='" . $id_attributo . "'";
 $idSuperColore = $readConnection->fetchOne($stringQuery);
 if ($idSuperColore == null) {
     $attribute_model = Mage::getModel('eav/entity_attribute');
     $attribute_options_model = Mage::getModel('eav/entity_attribute_source_table');
     $attribute_code = $attribute_model->getIdByCode('catalog_product', "ca_000001");
     $attribute = $attribute_model->load($attribute_code);
     $attribute->setData('option', array('value' => array('option' => array(ucfirst(strtolower($stringaValoreAttributo)), ucfirst(strtolower($stringaValoreAttributo))))));
     $attribute->save();
     $setup = new Mage_Eav_Model_Entity_Setup('core_setup');
     $optionTable = $setup->getTable('eav/attribute_option');
     $idSuperColore = getLastInsertId($optionTable, 'option_id');
     $query = "insert into " . $resource->getTableName('wsca_subattributes') . " (id_magento,id_ws, id_attributes) values('" . $idSuperColore . "','" . $stringaIdAttributo . "','" . $id_attributo . "')";
     $writeConnection->query($query);
 }
 if (count($supercolore) == 1) {
     // recupero il nome della stagione
     $entityType = Mage::getModel('eav/config')->getEntityType('catalog_product');
     $attributeModel = Mage::getModel('eav/entity_attribute')->loadByCode($entityType, "ca_colore");
     $_collection = Mage::getResourceModel('eav/entity_attribute_option_collection')->setAttributeFilter($attributeModel->getId())->setStoreFilter(3)->load();
     foreach ($_collection->toOptionArray() as $option) {
         if ($option['value'] == $id_valoreattributoMage) {
             $nome_colore = $option['label'];
             break;
         }
     }
     $stringQuery = "select id_magento from " . $resource->getTableName('wsca_filtraggio_colore') . " where id_ws='" . $id_valoreattributo . "'";
开发者ID:technomagegithub,项目名称:colb2b,代码行数:31,代码来源:modifica_prodotto.php

示例15: foreach

 foreach ($varianti as $key => $value) {
     $scalare = $key;
     $misura = $value;
     // controllo esistenza opzione in magento per l'attributo in questione
     $stringQuery = "select id_magento from " . $resource->getTableName('wsca_misura') . " where LOWER(misura)='" . strtolower($misura) . "'";
     $id_misuraMage = $readConnection->fetchOne($stringQuery);
     if ($id_misuraMage == null) {
         $attribute_model = Mage::getModel('eav/entity_attribute');
         $attribute_options_model = Mage::getModel('eav/entity_attribute_source_table');
         $attribute_code = $attribute_model->getIdByCode('catalog_product', "ca_misura");
         $attribute = $attribute_model->load($attribute_code);
         $attribute->setData('option', array('value' => array('option' => array(ucfirst(strtolower($misura)), ucfirst(strtolower($misura))))));
         $attribute->save();
         $setup = new Mage_Eav_Model_Entity_Setup('core_setup');
         $optionTable = $setup->getTable('eav/attribute_option');
         $id_misuraMage = getLastInsertId($optionTable, 'option_id');
         $query = "insert into " . $resource->getTableName('wsca_misura') . " (id_magento,misura) values('" . $id_misuraMage . "','" . strtolower($misura) . "')";
         $writeConnection->query($query);
     } else {
         $attr = Mage::getModel('catalog/product')->getResource()->getAttribute("ca_misura");
         if ($attr->usesSource()) {
             $nomeMisuraMage = $attr->getSource()->getOptionText($id_misuraMage);
             if (strtolower($nomeMisuraMage) != strtolower($misura)) {
                 $attribute_model = Mage::getModel('eav/entity_attribute');
                 $attribute_options_model = Mage::getModel('eav/entity_attribute_source_table');
                 $attribute_code = $attribute_model->getIdByCode('catalog_product', "ca_misura");
                 $attribute = $attribute_model->load($attribute_code);
                 // modifica della stagione su magento (nome dell'opzione)
                 $data = array();
                 $values = array($id_misuraMage => array(0 => ucfirst(strtolower($misura)), 1 => ucfirst(strtolower($misura))));
                 $data['option']['value'] = $values;
开发者ID:technomagegithub,项目名称:colb2b,代码行数:31,代码来源:importCatalogo.php


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