本文整理汇总了PHP中Mysql::insert_id方法的典型用法代码示例。如果您正苦于以下问题:PHP Mysql::insert_id方法的具体用法?PHP Mysql::insert_id怎么用?PHP Mysql::insert_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mysql
的用法示例。
在下文中一共展示了Mysql::insert_id方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _add2mysql
/**
* Fügt einen Eintrag in die Datenbank ein. Wird von der Methode _create() aufgerufen.
*
* @param array $data Datenarray
*/
private function _add2mysql($data)
{
/*Parameter kontrollieren */
if (!is_array($data) || empty($data)) {
throw new CMSException(array('content' => 'wrong_param_array'), EXCEPTION_MODULE_CODE, "", array('content' => 'runtime_error'));
}
/*Modus Content hinzufügen */
$sql = "INSERT INTO `content` (`content_ID`, `content_title`, `content_text`, `content_time`, `content_archiv`) VALUES (";
$sql .= "'', '" . $this->_mysql->escapeString($data['c_title']) . "', '" . $this->_mysql->escapeString($this->_cutSessID($data['c_text'])) . "', NOW(),";
if ($data['c_hide'] == true) {
$sql .= "'yes'";
} else {
$sql .= "'no'";
}
$sql .= ")";
$this->_mysql->query($sql);
if ($data['m_ignore'] != true) {
$c_ID = $this->_mysql->insert_id();
$sql = "INSERT INTO `menu` (`menu_ID`, `menu_topid`, `menu_name`, `menu_position`, `menu_page`, `menu_pagetyp`, `menu_display`) VALUES (";
$sql .= "'', '" . $this->_mysql->escapeString($data['m_topid']) . "', '" . $this->_mysql->escapeString($data['m_name']) . "', '" . $this->_mysql->escapeString($data['m_pos']) . "', '{$c_ID}', 'pag',";
if ($data['m_display'] == true) {
$sql .= "'1'";
} else {
$sql .= "'0'";
}
$sql .= ")";
$this->_mysql->query($sql);
}
}
示例2: _add2mysql
/**
* Fügt einen Eintrag in die Datenbank ein. Wird von der Methode _create() aufgerufen.
*
* @param array $data Datenarray von checkformdata
*/
private function _add2mysql($data)
{
/*Parameter kontrollieren */
if (!is_array($data) || empty($data)) {
throw new CMSException(array('menu' => 'wrong_param_array'), EXCEPTION_MODULE_CODE, array('menu' => 'runtime_error'));
}
$sql = "INSERT INTO `menu` (`menu_ID`, `menu_topid`, `menu_name`, `menu_position`, `menu_page`, `menu_pagetyp`," . " `menu_display`) VALUES ('', '" . $this->_mysql->escapeString($data['m_topid']) . "', " . "'" . $this->_mysql->escapeString($data['m_name']) . "', '" . $this->_mysql->escapeString($data['m_pos']) . "', " . "'" . $this->_mysql->escapeString($data['m_page']) . "', '" . $this->_mysql->escapeString($data['m_modus']) . "',";
if ($data['m_display'] == true) {
$sql .= "'1'";
} else {
$sql .= "'0'";
}
$sql .= ")";
$this->_mysql->query($sql);
if ($this->_mysql->insert_id() == $data['m_topid']) {
$error_str = $this->_config_textes['Menu']['menu_ID_impossible'];
throw new Exception($error_str, EXCEPTION_CORE_CODE, $this->_config_textes['Menu']['lucky_dog']);
}
}