當前位置: 首頁>>代碼示例>>PHP>>正文


PHP PMA_loadFirstRow函數代碼示例

本文整理匯總了PHP中PMA_loadFirstRow函數的典型用法代碼示例。如果您正苦於以下問題:PHP PMA_loadFirstRow函數的具體用法?PHP PMA_loadFirstRow怎麽用?PHP PMA_loadFirstRow使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了PMA_loadFirstRow函數的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testLoadFirstRow

 /**
  * Test for PMA_loadFirstRow
  *
  * @return void
  */
 public function testLoadFirstRow()
 {
     $GLOBALS['cfg']['InsertRows'] = 2;
     $dbi = $this->getMockBuilder('PMA_DatabaseInterface')->disableOriginalConstructor()->getMock();
     $dbi->expects($this->at(0))->method('query')->with('SELECT * FROM `db`.`table` LIMIT 1;', null, PMA_DatabaseInterface::QUERY_STORE)->will($this->returnValue('result1'));
     $GLOBALS['dbi'] = $dbi;
     $result = PMA_loadFirstRow('table', 'db');
     $this->assertEquals(array('result1', array(false, false)), $result);
 }
開發者ID:kfjihailong,項目名稱:phpMyAdmin,代碼行數:14,代碼來源:PMA_insert_edit_test.php

示例2: PMA_determineInsertOrEdit

/**
 * Function to determine Insert/Edit rows
 *
 * @param string $where_clause where clause
 * @param string $db           current database
 * @param string $table        current table
 *
 * @return mixed
 */
function PMA_determineInsertOrEdit($where_clause, $db, $table)
{
    if (isset($_REQUEST['where_clause'])) {
        $where_clause = $_REQUEST['where_clause'];
    }
    if (isset($_SESSION['edit_next'])) {
        $where_clause = $_SESSION['edit_next'];
        unset($_SESSION['edit_next']);
        $after_insert = 'edit_next';
    }
    if (isset($_REQUEST['ShowFunctionFields'])) {
        $GLOBALS['cfg']['ShowFunctionFields'] = $_REQUEST['ShowFunctionFields'];
    }
    if (isset($_REQUEST['ShowFieldTypesInDataEditView'])) {
        $GLOBALS['cfg']['ShowFieldTypesInDataEditView'] = $_REQUEST['ShowFieldTypesInDataEditView'];
    }
    if (isset($_REQUEST['after_insert'])) {
        $after_insert = $_REQUEST['after_insert'];
    }
    if (isset($where_clause)) {
        // we are editing
        $insert_mode = false;
        $where_clause_array = PMA_getWhereClauseArray($where_clause);
        list($where_clauses, $result, $rows, $found_unique_key) = PMA_analyzeWhereClauses($where_clause_array, $table, $db);
    } else {
        // we are inserting
        $insert_mode = true;
        $where_clause = null;
        list($result, $rows) = PMA_loadFirstRow($table, $db);
        $where_clauses = null;
        $where_clause_array = array();
        $found_unique_key = false;
    }
    // Copying a row - fetched data will be inserted as a new row,
    // therefore the where clause is needless.
    if (isset($_REQUEST['default_action']) && $_REQUEST['default_action'] === 'insert') {
        $where_clause = $where_clauses = null;
    }
    return array($insert_mode, $where_clause, $where_clause_array, $where_clauses, $result, $rows, $found_unique_key, isset($after_insert) ? $after_insert : null);
}
開發者ID:hewenhao2008,項目名稱:phpmyadmin,代碼行數:49,代碼來源:insert_edit.lib.php

示例3: PMA_DBI_select_db

PMA_DBI_select_db($db);
$table_fields = array_values(PMA_DBI_get_columns($db, $table));
$paramTableDbArray = array($table, $db);
/**
 * Determine what to do, edit or insert? 
 */
if (isset($where_clause)) {
    // we are editing
    $insert_mode = false;
    $where_clause_array = PMA_getWhereClauseArray($where_clause);
    list($where_clauses, $result, $rows, $found_unique_key) = PMA_analyzeWhereClauses($where_clause_array, $table, $db);
} else {
    // we are inserting
    $insert_mode = true;
    $where_clause = null;
    list($result, $rows) = PMA_loadFirstRow($table, $db);
    $where_clauses = null;
    $where_clause_array = null;
    $found_unique_key = false;
}
// Copying a row - fetched data will be inserted as a new row,
// therefore the where clause is needless.
if (isset($_REQUEST['default_action']) && $_REQUEST['default_action'] === 'insert') {
    $where_clause = $where_clauses = null;
}
// retrieve keys into foreign fields, if any
$foreigners = PMA_getForeigners($db, $table);
// Retrieve form parameters for insert/edit form
$_form_params = PMA_getFormParametersForInsertForm($db, $table, $where_clauses, $where_clause_array, $err_url);
/**
 * Displays the form
開發者ID:mindfeederllc,項目名稱:openemr,代碼行數:31,代碼來源:tbl_change.php


注:本文中的PMA_loadFirstRow函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。