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


PHP PMA_DBI_insert_id函数代码示例

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


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

示例1: PMA_duplicate_table_info

/**
 * Inserts existing entries in a PMA_* table by reading a value from an old entry
 *
 * @param   string  The array index, which Relation feature to check
 *                  ('relwork', 'commwork', ...)
 * @param   string  The array index, which PMA-table to update
 *                  ('bookmark', 'relation', ...)
 * @param   array   Which fields will be SELECT'ed from the old entry
 * @param   array   Which fields will be used for the WHERE query
 *                  (array('FIELDNAME' => 'FIELDVALUE'))
 * @param   array   Which fields will be used as new VALUES. These are the important
 *                  keys which differ from the old entry.
 *                  (array('FIELDNAME' => 'NEW FIELDVALUE'))
 * @global  string  relation variable
 *
 * @author          Garvin Hicking <me@supergarv.de>
 */
function PMA_duplicate_table_info($work, $pma_table, $get_fields, $where_fields, $new_fields)
{
    global $cfgRelation;
    $last_id = -1;
    if ($cfgRelation[$work]) {
        $select_parts = array();
        $row_fields = array();
        foreach ($get_fields as $nr => $get_field) {
            $select_parts[] = PMA_backquote($get_field);
            $row_fields[$get_field] = 'cc';
        }
        $where_parts = array();
        foreach ($where_fields as $_where => $_value) {
            $where_parts[] = PMA_backquote($_where) . ' = \'' . PMA_sqlAddslashes($_value) . '\'';
        }
        $new_parts = array();
        $new_value_parts = array();
        foreach ($new_fields as $_where => $_value) {
            $new_parts[] = PMA_backquote($_where);
            $new_value_parts[] = PMA_sqlAddslashes($_value);
        }
        $table_copy_query = 'SELECT ' . implode(', ', $select_parts) . ' FROM ' . PMA_backquote($cfgRelation[$pma_table]) . ' WHERE ' . implode(' AND ', $where_parts);
        // must use PMA_DBI_QUERY_STORE here, since we execute another
        // query inside the loop
        $table_copy_rs = PMA_query_as_cu($table_copy_query, TRUE, PMA_DBI_QUERY_STORE);
        while ($table_copy_row = @PMA_DBI_fetch_assoc($table_copy_rs)) {
            $value_parts = array();
            foreach ($table_copy_row as $_key => $_val) {
                if (isset($row_fields[$_key]) && $row_fields[$_key] == 'cc') {
                    $value_parts[] = PMA_sqlAddslashes($_val);
                }
            }
            $new_table_query = 'INSERT IGNORE INTO ' . PMA_backquote($cfgRelation[$pma_table]) . ' (' . implode(', ', $select_parts) . ', ' . implode(', ', $new_parts) . ')' . ' VALUES ' . ' (\'' . implode('\', \'', $value_parts) . '\', \'' . implode('\', \'', $new_value_parts) . '\')';
            $new_table_rs = PMA_query_as_cu($new_table_query);
            $last_id = PMA_DBI_insert_id();
        }
        // end while
        return $last_id;
    }
    return true;
}
开发者ID:mike503,项目名称:phpmyadmin,代码行数:58,代码来源:tbl_move_copy.php

示例2: PMA_backquote

         $ch_query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['pdf_pages']) . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'' . ' AND   page_nr = ' . $chpage;
         PMA_query_as_cu($ch_query, FALSE, $query_default_option);
         unset($chpage);
     }
     break;
 case 'createpage':
     if (!isset($newpage) || $newpage == '') {
         $newpage = $strNoDescription;
     }
     $ins_query = 'INSERT INTO ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['pdf_pages']) . ' (db_name, page_descr)' . ' VALUES (\'' . PMA_sqlAddslashes($db) . '\', \'' . PMA_sqlAddslashes($newpage) . '\')';
     PMA_query_as_cu($ins_query, FALSE, $query_default_option);
     // A u t o m a t i c    l a y o u t
     // ================================
     if (isset($auto_layout_internal) || isset($auto_layout_innodb)) {
         // save the page number
         $pdf_page_number = PMA_DBI_insert_id(isset($controllink) ? $controllink : '');
         $all_tables = array();
     }
     if (isset($auto_layout_innodb)) {
         // get the tables list
         $tables = PMA_DBI_get_tables_full($db);
         // find the InnoDB ones
         $innodb_tables = array();
         foreach ($tables as $table_name => $table_properties) {
             if ($table_properties['ENGINE'] == 'InnoDB') {
                 $innodb_tables[] = $table_name;
             }
         }
         $all_tables = $innodb_tables;
         // could be improved by finding the tables which have the
         // most references keys and place them at the beginning
开发者ID:BGCX261,项目名称:zhss-svn-to-git,代码行数:31,代码来源:pdf_pages.php

示例3: foreach

foreach ($query as $query_index => $single_query) {
    if ($cfg['IgnoreMultiSubmitErrors']) {
        $result = PMA_DBI_try_query($single_query);
    } else {
        $result = PMA_DBI_query($single_query);
    }
    if (isset($GLOBALS['warning'])) {
        $warning_message .= $GLOBALS['warning'] . '[br]';
    }
    if (!$result) {
        $message .= PMA_DBI_getError();
    } else {
        if (@PMA_DBI_affected_rows()) {
            $total_affected_rows += @PMA_DBI_affected_rows();
        }
        $insert_id = PMA_DBI_insert_id();
        if ($insert_id != 0) {
            $last_message .= '[br]' . $strInsertedRowId . '&nbsp;' . $insert_id;
        }
    }
    // end if
    PMA_DBI_free_result($result);
    unset($result);
}
if ($total_affected_rows != 0) {
    $message .= $total_affected_rows;
} else {
    $message .= $strModifications;
}
$message .= $last_message;
if (!empty($warning_message)) {
开发者ID:BGCX261,项目名称:zhss-svn-to-git,代码行数:31,代码来源:tbl_replace.php

示例4: duplicateInfo

 /**
  * Inserts existing entries in a PMA_* table by reading a value from an old
  * entry
  *
  * @param string $work         The array index, which Relation feature to
  *                             check ('relwork', 'commwork', ...)
  * @param string $pma_table    The array index, which PMA-table to update
  *                             ('bookmark', 'relation', ...)
  * @param array  $get_fields   Which fields will be SELECT'ed from the old entry
  * @param array  $where_fields Which fields will be used for the WHERE query
  *                             (array('FIELDNAME' => 'FIELDVALUE'))
  * @param array  $new_fields   Which fields will be used as new VALUES.
  *                             These are the important keys which differ
  *                             from the old entry
  *                             (array('FIELDNAME' => 'NEW FIELDVALUE'))
  *
  * @global relation variable
  *
  * @return int|true
  */
 public static function duplicateInfo($work, $pma_table, $get_fields, $where_fields, $new_fields)
 {
     $last_id = -1;
     if (isset($GLOBALS['cfgRelation']) && $GLOBALS['cfgRelation'][$work]) {
         $select_parts = array();
         $row_fields = array();
         foreach ($get_fields as $get_field) {
             $select_parts[] = PMA_Util::backquote($get_field);
             $row_fields[$get_field] = 'cc';
         }
         $where_parts = array();
         foreach ($where_fields as $_where => $_value) {
             $where_parts[] = PMA_Util::backquote($_where) . ' = \'' . PMA_Util::sqlAddSlashes($_value) . '\'';
         }
         $new_parts = array();
         $new_value_parts = array();
         foreach ($new_fields as $_where => $_value) {
             $new_parts[] = PMA_Util::backquote($_where);
             $new_value_parts[] = PMA_Util::sqlAddSlashes($_value);
         }
         $table_copy_query = '
             SELECT ' . implode(', ', $select_parts) . '
               FROM ' . PMA_Util::backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_Util::backquote($GLOBALS['cfgRelation'][$pma_table]) . '
              WHERE ' . implode(' AND ', $where_parts);
         // must use PMA_DBI_QUERY_STORE here, since we execute another
         // query inside the loop
         $table_copy_rs = PMA_queryAsControlUser($table_copy_query, true, PMA_DBI_QUERY_STORE);
         while ($table_copy_row = @PMA_DBI_fetch_assoc($table_copy_rs)) {
             $value_parts = array();
             foreach ($table_copy_row as $_key => $_val) {
                 if (isset($row_fields[$_key]) && $row_fields[$_key] == 'cc') {
                     $value_parts[] = PMA_Util::sqlAddSlashes($_val);
                 }
             }
             $new_table_query = 'INSERT IGNORE INTO ' . PMA_Util::backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_Util::backquote($GLOBALS['cfgRelation'][$pma_table]) . '
                 (' . implode(', ', $select_parts) . ',
                  ' . implode(', ', $new_parts) . ')
                 VALUES
                 (\'' . implode('\', \'', $value_parts) . '\',
                  \'' . implode('\', \'', $new_value_parts) . '\')';
             PMA_queryAsControlUser($new_table_query);
             $last_id = PMA_DBI_insert_id();
         }
         // end while
         PMA_DBI_free_result($table_copy_rs);
         return $last_id;
     }
     return true;
 }
开发者ID:mindfeederllc,项目名称:openemr,代码行数:69,代码来源:Table.class.php

示例5: PMA_REL_create_page

/**
 * Create a PDF page
 *
 * @param string $newpage     name of the new PDF page
 * @param array  $cfgRelation
 * @param string $db          database name
 *
 * @return string   $pdf_page_number
 */
function PMA_REL_create_page($newpage, $cfgRelation, $db)
{
    if (!isset($newpage) || $newpage == '') {
        $newpage = __('no description');
    }
    $ins_query = 'INSERT INTO ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['pdf_pages']) . ' (db_name, page_descr)' . ' VALUES (\'' . PMA_sqlAddSlashes($db) . '\', \'' . PMA_sqlAddSlashes($newpage) . '\')';
    PMA_query_as_controluser($ins_query, false);
    return PMA_DBI_insert_id(isset($GLOBALS['controllink']) ? $GLOBALS['controllink'] : '');
}
开发者ID:AmberWish,项目名称:laba_web,代码行数:18,代码来源:relation.lib.php

示例6: PMA_executeSqlQuery

/**
 * Executes the sql query and get the result, then move back to the calling page
 *
 * @param array  $url_params url paramters array
 * @param string $query      built query from PMA_buildSqlQuery()
 *
 * @return array             $url_params, $total_affected_rows, $last_messages
 *                           $warning_messages, $error_messages, $return_to_sql_query
 */
function PMA_executeSqlQuery($url_params, $query)
{
    $return_to_sql_query = '';
    if (!empty($GLOBALS['sql_query'])) {
        $url_params['sql_query'] = $GLOBALS['sql_query'];
        $return_to_sql_query = $GLOBALS['sql_query'];
    }
    $GLOBALS['sql_query'] = implode('; ', $query) . ';';
    // to ensure that the query is displayed in case of
    // "insert as new row" and then "insert another new row"
    $GLOBALS['display_query'] = $GLOBALS['sql_query'];
    $total_affected_rows = 0;
    $last_messages = array();
    $warning_messages = array();
    $error_messages = array();
    foreach ($query as $single_query) {
        if ($_REQUEST['submit_type'] == 'showinsert') {
            $last_messages[] = PMA_Message::notice(__('Showing SQL query'));
            continue;
        }
        if ($GLOBALS['cfg']['IgnoreMultiSubmitErrors']) {
            $result = PMA_DBI_try_query($single_query);
        } else {
            $result = PMA_DBI_query($single_query);
        }
        if (!$result) {
            $error_messages[] = PMA_Message::sanitize(PMA_DBI_getError());
        } else {
            // The next line contains a real assignment, it's not a typo
            if ($tmp = @PMA_DBI_affected_rows()) {
                $total_affected_rows += $tmp;
            }
            unset($tmp);
            $insert_id = PMA_DBI_insert_id();
            if ($insert_id != 0) {
                // insert_id is id of FIRST record inserted in one insert, so if we
                // inserted multiple rows, we had to increment this
                if ($total_affected_rows > 0) {
                    $insert_id = $insert_id + $total_affected_rows - 1;
                }
                $last_message = PMA_Message::notice(__('Inserted row id: %1$d'));
                $last_message->addParam($insert_id);
                $last_messages[] = $last_message;
            }
            PMA_DBI_free_result($result);
        }
        $warning_messages = PMA_getWarningMessages();
    }
    return array($url_params, $total_affected_rows, $last_messages, $warning_messages, $error_messages, $return_to_sql_query);
}
开发者ID:nhodges,项目名称:phpmyadmin,代码行数:59,代码来源:insert_edit.lib.php

示例7: PMA_REL_create_page

/**
 * Create a PDF page
 *
 * @uses    $GLOBALS['strNoDescription']
 * @uses    PMA_backquote()
 * @uses    $GLOBALS['cfgRelation']['db']
 * @uses    PMA_sqlAddslashes()
 * @uses    PMA_query_as_cu()
 * @uses    PMA_DBI_insert_id()
 * @uses    $GLOBALS['controllink']
 * @param string    $newpage
 * @param array     $cfgRelation
 * @param string    $db
 * @param string    $query_default_option
 * @return string   $pdf_page_number
 */
function PMA_REL_create_page($newpage, $cfgRelation, $db, $query_default_option) {
    if (! isset($newpage) || $newpage == '') {
        $newpage = $GLOBALS['strNoDescription'];
    }
    $ins_query   = 'INSERT INTO ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['pdf_pages'])
                 . ' (db_name, page_descr)'
                 . ' VALUES (\'' . PMA_sqlAddslashes($db) . '\', \'' . PMA_sqlAddslashes($newpage) . '\')';
    PMA_query_as_cu($ins_query, FALSE, $query_default_option);
    return PMA_DBI_insert_id(isset($GLOBALS['controllink']) ? $GLOBALS['controllink'] : '');
}
开发者ID:blumenbach,项目名称:blumenbach-online.de,代码行数:26,代码来源:relation.lib.php

示例8: PMA_query_as_cu

         PMA_query_as_cu($ch_query, FALSE, $query_default_option);
         unset($chpage);
     }
     break;
 case 'createpage':
     if (!isset($newpage) || $newpage == '') {
         $newpage = $strNoDescription;
     }
     $ins_query = 'INSERT INTO ' . PMA_backquote($cfgRelation['pdf_pages']) . ' (db_name, page_descr)' . ' VALUES (\'' . PMA_sqlAddslashes($db) . '\', \'' . PMA_sqlAddslashes($newpage) . '\')';
     PMA_query_as_cu($ins_query, FALSE, $query_default_option);
     // A u t o m a t i c    l a y o u t
     //
     // TODO: support InnoDB
     if (isset($autolayout)) {
         // save the page number
         $pdf_page_number = PMA_DBI_insert_id(isset($dbh) ? $dbh : '');
         // get the tables that have relations, by descending
         // number of links
         $master_tables = 'SELECT COUNT(master_table), master_table' . ' FROM ' . PMA_backquote($cfgRelation['relation']) . ' WHERE master_db = \'' . $db . '\'' . ' GROUP BY master_table' . ' ORDER BY ' . PMA_backquote('COUNT(master_table)') . ' DESC ';
         $master_tables_rs = PMA_query_as_cu($master_tables, FALSE, $query_default_option);
         if ($master_tables_rs && PMA_DBI_num_rows($master_tables_rs) > 0) {
             // first put all the master tables at beginning
             // of the list, so they are near the center of
             // the schema
             while (list(, $master_table) = PMA_DBI_fetch_row($master_tables_rs)) {
                 $all_tables[] = $master_table;
             }
             // then for each master, add its foreigns into an array
             // of foreign tables, if not already there
             // (a foreign might be foreign for more than
             // one table, and might be a master itself)
开发者ID:BackupTheBerlios,项目名称:vhcs-svn,代码行数:31,代码来源:pdf_pages.php

示例9: PMA_REL_createPage

/**
 * Create a PDF page
 *
 * @param string $newpage     name of the new PDF page
 * @param array  $cfgRelation Relation configuration
 * @param string $db          database name
 *
 * @return string   $pdf_page_number
 */
function PMA_REL_createPage($newpage, $cfgRelation, $db)
{
    $common_functions = PMA_CommonFunctions::getInstance();
    if (!isset($newpage) || $newpage == '') {
        $newpage = __('no description');
    }
    $ins_query = 'INSERT INTO ' . $common_functions->backquote($GLOBALS['cfgRelation']['db']) . '.' . $common_functions->backquote($cfgRelation['pdf_pages']) . ' (db_name, page_descr)' . ' VALUES (\'' . $common_functions->sqlAddSlashes($db) . '\', \'' . $common_functions->sqlAddSlashes($newpage) . '\')';
    PMA_queryAsControlUser($ins_query, false);
    return PMA_DBI_insert_id(isset($GLOBALS['controllink']) ? $GLOBALS['controllink'] : '');
}
开发者ID:rajatsinghal,项目名称:phpmyadmin,代码行数:19,代码来源:relation.lib.php


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