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


PHP rex_sql::getLastId方法代码示例

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


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

示例1: execute

 function execute()
 {
     // echo "DB EXECUTE";
     // return;
     $sql = new rex_sql();
     if ($this->params["debug"]) {
         $sql->debugsql = TRUE;
     }
     $main_table = "";
     if (isset($this->action["elements"][2]) && $this->action["elements"][2] != "") {
         $main_table = $this->action["elements"][2];
     } else {
         $main_table = $this->params["main_table"];
     }
     if ($main_table == "") {
         $this->params["form_show"] = TRUE;
         $this->params["hasWarnings"] = TRUE;
         $this->params["warning_messages"][] = $this->params["Error-Code-InsertQueryError"];
         return FALSE;
     }
     $sql->setTable($main_table);
     $where = "";
     if (isset($this->action["elements"][3]) && trim($this->action["elements"][3]) != "") {
         $where = trim($this->action["elements"][3]);
     }
     // SQL Objekt mit Werten füllen
     foreach ($this->elements_sql as $key => $value) {
         $sql->setValue($key, $value);
         if ($where != "") {
             $where = str_replace('###' . $key . '###', addslashes($value), $where);
         }
     }
     if ($where != "") {
         $sql->setWhere($where);
         $sql->update();
         $flag = "update";
     } else {
         $sql->insert();
         $flag = "insert";
         $id = $sql->getLastId();
         $this->elements_email["ID"] = $id;
         // $this->elements_sql["ID"] = $id;
         if ($id == 0) {
             $this->params["form_show"] = TRUE;
             $this->params["hasWarnings"] = TRUE;
             $this->params["warning_messages"][] = $this->params["Error-Code-InsertQueryError"];
         }
     }
 }
开发者ID:BackupTheBerlios,项目名称:redaxo-svn,代码行数:49,代码来源:class.xform.action_db.inc.php

示例2: cacheSearch

 /** 
  * Stores a search result in the cache.
  * 
  * @param string $_result
  * @param array $_indexIds
  * 
  * @return bool
  */
 function cacheSearch($_result, $_indexIds)
 {
     $sql = new rex_sql();
     $sql->setTable($this->tablePrefix . '587_searchcache');
     $sql->setValues(array('hash' => $this->cacheHash($this->searchString), 'returnarray' => $sql->escape($_result)));
     $sql->insert();
     $lastId = $sql->getLastId();
     $Ainsert = array();
     foreach ($_indexIds as $id) {
         $Ainsert[] = sprintf('(%d,%d)', $id, $lastId);
     }
     $sql2 = new rex_sql();
     return $sql2->setQuery(sprintf('INSERT INTO `%s` (index_id,cache_id) VALUES
     %s;', $this->tablePrefix . '587_searchcacheindex_ids', implode(',', $Ainsert)));
 }
开发者ID:olien,项目名称:rexsearch,代码行数:23,代码来源:class.rexsearch.inc.php

示例3: VALUES

<?php

$error = '';
$sql = new rex_sql();
//$sql->debugsql = true;
// add single image imagetype
$sql->setQuery("SELECT * FROM `" . $REX['TABLE_PREFIX'] . "679_types` WHERE name LIKE 'magnific_popup_image_thumb'");
if ($sql->getRows() == 0) {
    // imagetype
    $sql->setQuery("INSERT INTO `" . $REX['TABLE_PREFIX'] . "679_types` (status, name, description) VALUES (0, 'magnific_popup_image_thumb', 'Magnific Popup Einzelbild Vorschaubild')");
    $lastId = $sql->getLastId();
    // effects
    $sql->setQuery("INSERT INTO `" . $REX['TABLE_PREFIX'] . "679_type_effects` (type_id, effect, parameters, prior, updatedate, updateuser, createdate, createuser) VALUES (" . $lastId . ", 'resize','a:8:{s:15:\"rex_effect_crop\";a:6:{s:21:\"rex_effect_crop_width\";s:0:\"\";s:22:\"rex_effect_crop_height\";s:0:\"\";s:28:\"rex_effect_crop_offset_width\";s:0:\"\";s:29:\"rex_effect_crop_offset_height\";s:0:\"\";s:20:\"rex_effect_crop_hpos\";s:6:\"center\";s:20:\"rex_effect_crop_vpos\";s:6:\"middle\";}s:22:\"rex_effect_filter_blur\";a:3:{s:29:\"rex_effect_filter_blur_amount\";s:2:\"80\";s:29:\"rex_effect_filter_blur_radius\";s:1:\"8\";s:32:\"rex_effect_filter_blur_threshold\";s:1:\"3\";}s:25:\"rex_effect_filter_sharpen\";a:3:{s:32:\"rex_effect_filter_sharpen_amount\";s:2:\"80\";s:32:\"rex_effect_filter_sharpen_radius\";s:3:\"0.5\";s:35:\"rex_effect_filter_sharpen_threshold\";s:1:\"3\";}s:15:\"rex_effect_flip\";a:1:{s:20:\"rex_effect_flip_flip\";s:1:\"X\";}s:23:\"rex_effect_insert_image\";a:5:{s:34:\"rex_effect_insert_image_brandimage\";s:0:\"\";s:28:\"rex_effect_insert_image_hpos\";s:4:\"left\";s:28:\"rex_effect_insert_image_vpos\";s:3:\"top\";s:33:\"rex_effect_insert_image_padding_x\";s:3:\"-10\";s:33:\"rex_effect_insert_image_padding_y\";s:3:\"-10\";}s:17:\"rex_effect_mirror\";a:5:{s:24:\"rex_effect_mirror_height\";s:0:\"\";s:33:\"rex_effect_mirror_set_transparent\";s:7:\"colored\";s:22:\"rex_effect_mirror_bg_r\";s:0:\"\";s:22:\"rex_effect_mirror_bg_g\";s:0:\"\";s:22:\"rex_effect_mirror_bg_b\";s:0:\"\";}s:17:\"rex_effect_resize\";a:4:{s:23:\"rex_effect_resize_width\";s:3:\"500\";s:24:\"rex_effect_resize_height\";s:0:\"\";s:23:\"rex_effect_resize_style\";s:7:\"maximum\";s:31:\"rex_effect_resize_allow_enlarge\";s:7:\"enlarge\";}s:20:\"rex_effect_workspace\";a:8:{s:26:\"rex_effect_workspace_width\";s:0:\"\";s:27:\"rex_effect_workspace_height\";s:0:\"\";s:25:\"rex_effect_workspace_hpos\";s:4:\"left\";s:25:\"rex_effect_workspace_vpos\";s:3:\"top\";s:36:\"rex_effect_workspace_set_transparent\";s:7:\"colored\";s:25:\"rex_effect_workspace_bg_r\";s:0:\"\";s:25:\"rex_effect_workspace_bg_g\";s:0:\"\";s:25:\"rex_effect_workspace_bg_b\";s:0:\"\";}}',1," . time() . ",'admin'," . time() . ",'admin')");
}
// add gallery image imagetype
$sql->setQuery("SELECT * FROM `" . $REX['TABLE_PREFIX'] . "679_types` WHERE name LIKE 'magnific_popup_gallery_thumb'");
if ($sql->getRows() == 0) {
    // imagetype
    $sql->setQuery("INSERT INTO `" . $REX['TABLE_PREFIX'] . "679_types` (status, name, description) VALUES (0, 'magnific_popup_gallery_thumb', 'Magnific Popup Galerie Vorschaubild')");
    $lastId = $sql->getLastId();
    // effects
    $sql->setQuery("INSERT INTO `" . $REX['TABLE_PREFIX'] . "679_type_effects` (type_id, effect, parameters, prior, updatedate, updateuser, createdate, createuser) VALUES (" . $lastId . ", 'resize','a:8:{s:15:\"rex_effect_crop\";a:6:{s:21:\"rex_effect_crop_width\";s:0:\"\";s:22:\"rex_effect_crop_height\";s:0:\"\";s:28:\"rex_effect_crop_offset_width\";s:0:\"\";s:29:\"rex_effect_crop_offset_height\";s:0:\"\";s:20:\"rex_effect_crop_hpos\";s:6:\"center\";s:20:\"rex_effect_crop_vpos\";s:6:\"middle\";}s:22:\"rex_effect_filter_blur\";a:3:{s:29:\"rex_effect_filter_blur_amount\";s:2:\"80\";s:29:\"rex_effect_filter_blur_radius\";s:1:\"8\";s:32:\"rex_effect_filter_blur_threshold\";s:1:\"3\";}s:25:\"rex_effect_filter_sharpen\";a:3:{s:32:\"rex_effect_filter_sharpen_amount\";s:2:\"80\";s:32:\"rex_effect_filter_sharpen_radius\";s:3:\"0.5\";s:35:\"rex_effect_filter_sharpen_threshold\";s:1:\"3\";}s:15:\"rex_effect_flip\";a:1:{s:20:\"rex_effect_flip_flip\";s:1:\"X\";}s:23:\"rex_effect_insert_image\";a:5:{s:34:\"rex_effect_insert_image_brandimage\";s:0:\"\";s:28:\"rex_effect_insert_image_hpos\";s:4:\"left\";s:28:\"rex_effect_insert_image_vpos\";s:3:\"top\";s:33:\"rex_effect_insert_image_padding_x\";s:3:\"-10\";s:33:\"rex_effect_insert_image_padding_y\";s:3:\"-10\";}s:17:\"rex_effect_mirror\";a:5:{s:24:\"rex_effect_mirror_height\";s:0:\"\";s:33:\"rex_effect_mirror_set_transparent\";s:7:\"colored\";s:22:\"rex_effect_mirror_bg_r\";s:0:\"\";s:22:\"rex_effect_mirror_bg_g\";s:0:\"\";s:22:\"rex_effect_mirror_bg_b\";s:0:\"\";}s:17:\"rex_effect_resize\";a:4:{s:23:\"rex_effect_resize_width\";s:3:\"200\";s:24:\"rex_effect_resize_height\";s:3:\"133\";s:23:\"rex_effect_resize_style\";s:7:\"minimum\";s:31:\"rex_effect_resize_allow_enlarge\";s:7:\"enlarge\";}s:20:\"rex_effect_workspace\";a:8:{s:26:\"rex_effect_workspace_width\";s:0:\"\";s:27:\"rex_effect_workspace_height\";s:0:\"\";s:25:\"rex_effect_workspace_hpos\";s:4:\"left\";s:25:\"rex_effect_workspace_vpos\";s:3:\"top\";s:36:\"rex_effect_workspace_set_transparent\";s:7:\"colored\";s:25:\"rex_effect_workspace_bg_r\";s:0:\"\";s:25:\"rex_effect_workspace_bg_g\";s:0:\"\";s:25:\"rex_effect_workspace_bg_b\";s:0:\"\";}}',1," . time() . ",'admin'," . time() . ",'admin')");
    $sql->setQuery("INSERT INTO `" . $REX['TABLE_PREFIX'] . "679_type_effects` (type_id, effect, parameters, prior, updatedate, updateuser, createdate, createuser) VALUES (" . $lastId . ", 'crop','a:8:{s:15:\"rex_effect_crop\";a:6:{s:21:\"rex_effect_crop_width\";s:3:\"200\";s:22:\"rex_effect_crop_height\";s:3:\"133\";s:28:\"rex_effect_crop_offset_width\";s:0:\"\";s:29:\"rex_effect_crop_offset_height\";s:0:\"\";s:20:\"rex_effect_crop_hpos\";s:6:\"center\";s:20:\"rex_effect_crop_vpos\";s:6:\"middle\";}s:22:\"rex_effect_filter_blur\";a:3:{s:29:\"rex_effect_filter_blur_amount\";s:2:\"80\";s:29:\"rex_effect_filter_blur_radius\";s:1:\"8\";s:32:\"rex_effect_filter_blur_threshold\";s:1:\"3\";}s:25:\"rex_effect_filter_sharpen\";a:3:{s:32:\"rex_effect_filter_sharpen_amount\";s:2:\"80\";s:32:\"rex_effect_filter_sharpen_radius\";s:3:\"0.5\";s:35:\"rex_effect_filter_sharpen_threshold\";s:1:\"3\";}s:15:\"rex_effect_flip\";a:1:{s:20:\"rex_effect_flip_flip\";s:1:\"X\";}s:23:\"rex_effect_insert_image\";a:5:{s:34:\"rex_effect_insert_image_brandimage\";s:0:\"\";s:28:\"rex_effect_insert_image_hpos\";s:4:\"left\";s:28:\"rex_effect_insert_image_vpos\";s:3:\"top\";s:33:\"rex_effect_insert_image_padding_x\";s:3:\"-10\";s:33:\"rex_effect_insert_image_padding_y\";s:3:\"-10\";}s:17:\"rex_effect_mirror\";a:5:{s:24:\"rex_effect_mirror_height\";s:0:\"\";s:33:\"rex_effect_mirror_set_transparent\";s:7:\"colored\";s:22:\"rex_effect_mirror_bg_r\";s:0:\"\";s:22:\"rex_effect_mirror_bg_g\";s:0:\"\";s:22:\"rex_effect_mirror_bg_b\";s:0:\"\";}s:17:\"rex_effect_resize\";a:4:{s:23:\"rex_effect_resize_width\";s:0:\"\";s:24:\"rex_effect_resize_height\";s:0:\"\";s:23:\"rex_effect_resize_style\";s:7:\"maximum\";s:31:\"rex_effect_resize_allow_enlarge\";s:7:\"enlarge\";}s:20:\"rex_effect_workspace\";a:8:{s:26:\"rex_effect_workspace_width\";s:0:\"\";s:27:\"rex_effect_workspace_height\";s:0:\"\";s:25:\"rex_effect_workspace_hpos\";s:4:\"left\";s:25:\"rex_effect_workspace_vpos\";s:3:\"top\";s:36:\"rex_effect_workspace_set_transparent\";s:7:\"colored\";s:25:\"rex_effect_workspace_bg_r\";s:0:\"\";s:25:\"rex_effect_workspace_bg_g\";s:0:\"\";s:25:\"rex_effect_workspace_bg_b\";s:0:\"\";}}',2," . time() . ",'admin'," . time() . ",'admin')");
}
if ($error == '') {
    $REX['ADDON']['install']['magnific_popup'] = true;
} else {
    $REX['ADDON']['installmsg']['magnific_popup'] = $error;
}
开发者ID:darwin26,项目名称:magnific_popup,代码行数:29,代码来源:install.inc.php

示例4: stripslashes

 // Daten wieder in den Rohzustand versetzen, da für serialize()/unserialize()
 // keine Zeichen escaped werden dürfen
 for ($i = 1; $i < count($ctypes) + 1; $i++) {
     $ctypes[$i] = stripslashes($ctypes[$i]);
 }
 $TPL = new rex_sql();
 $TPL->setTable($REX['TABLE_PREFIX'] . "template");
 $TPL->setValue("name", $templatename);
 $TPL->setValue("active", $active);
 $TPL->setValue("content", $content);
 if ($function == "add") {
     $attributes = rex_setAttributes("ctype", $ctypes, "");
     $TPL->setValue("attributes", addslashes($attributes));
     $TPL->addGlobalCreateFields();
     if ($TPL->insert()) {
         $template_id = $TPL->getLastId();
         $message = $I18N->msg("template_added");
     } else {
         $message = $TPL->getError();
     }
 } else {
     $attributes = rex_setAttributes("ctype", $ctypes, $attributes);
     $TPL->setWhere("id='{$template_id}'");
     $TPL->setValue("attributes", addslashes($attributes));
     $TPL->addGlobalUpdateFields();
     $message = $TPL->update($I18N->msg("template_updated"));
 }
 // werte werden direkt wieder ausgegeben
 $templatename = stripslashes($templatename);
 $content = stripslashes($content);
 rex_deleteDir($REX['INCLUDE_PATH'] . "/generated/templates", 0);
开发者ID:BackupTheBerlios,项目名称:redaxo-svn,代码行数:31,代码来源:template.inc.php

示例5: save

 /**
  * Speichert den Kurs in die Datenbank.
  * @return String Statusmeldung.
  */
 public function save()
 {
     $query = "INSERT INTO ";
     if ($this->kurs_id > 0) {
         $query = "UPDATE ";
     }
     $query .= $this->table_prefix . 'd2u_kurse_kurse SET ' . 'titel = "' . addslashes($this->titel) . '", ' . 'teaser = "' . addslashes($this->teaser) . '", ' . 'beschreibung = "' . addslashes($this->beschreibung) . '", ' . '`alter` = "' . $this->alter . '", ' . 'bild = "' . $this->bild . '", ' . 'kosten = ' . number_format($this->kosten, 2) . ', ' . 'kosten_erm = ' . number_format($this->kosten_erm, 2) . ', ' . 'datum_von = "' . $this->datum_von . '", ' . 'datum_bis = "' . $this->datum_bis . '", ' . 'uhrzeit = "' . $this->uhrzeit . '", ' . 'zielgruppen_ids = "|' . implode("|", $this->zielgruppen_ids) . '|", ' . 'kurskategorie_id = "' . $this->kurskategorie->kurskategorie_id . '", ' . 'sekundaere_kurskategorie_ids = "|' . implode("|", $this->sekundaere_kurskategorie_ids) . '|", ' . 'ort_id = "' . $this->ort->ort_id . '", ' . 'raum = "' . $this->raum . '", ' . 'terminkategorie_ids = "|' . implode("|", $this->terminkategorie_ids) . '|", ' . 'teilnehmer_max = "' . $this->teilnehmer_max . '", ' . 'teilnehmer_min = "' . $this->teilnehmer_min . '", ' . 'teilnehmer_angemeldet = "' . $this->teilnehmer_angemeldet . '", ' . 'teilnehmer_warteliste = "' . $this->teilnehmer_warteliste . '", ' . 'anmeldung_moeglich = "' . $this->anmeldung_moeglich . '", ' . 'status = "' . $this->status . '", ' . 'url_extern = "' . $this->url_extern . '", ' . 'redaxo_artikel = "' . $this->redaxo_artikel . '", ' . 'kursleiter = "' . $this->kursleiter . '", ' . 'kursnummer = "' . $this->kursnummer . '", ' . 'dokumente = "' . implode(",", $this->dokumente) . '", ' . 'import = "' . $this->import . '", ' . 'updatedate = "' . time() . '"';
     if ($this->kurs_id > 0) {
         $query .= " WHERE kurs_id = " . $this->kurs_id;
     }
     $result = new rex_sql();
     $result->setQuery($query);
     if ($this->kurs_id == 0) {
         $this->kurs_id = $result->getLastId();
     }
     if ($result->hasError()) {
         return "Fehler beim Speichern: " . $result->getError() . PHP_EOL . "Query war: " . $query;
     } else {
         return "Gespeichert: " . $query;
     }
 }
开发者ID:TobiasKrais,项目名称:d2u_kurse,代码行数:25,代码来源:class.kurs.inc.php


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