next column if (empty($funcs[$encoded_key]) && isset($fields_prev) && isset($fields_prev[$encoded_key]) && ("'" . PMA_sqlAddslashes(urldecode($fields_prev[$encoded_key])) . "'" == $val)) { continue; } else if (!empty($val)) { if (empty($funcs[$encoded_key])) { $valuelist .= PMA_backquote($key) . ' = ' . $val . ', '; } else if ($val == '\'\'' && (ereg('^(NOW|CURDATE|CURTIME|UNIX_TIMESTAMP|RAND|USER|LAST_INSERT_ID)$', $funcs[$encoded_key]))) { $valuelist .= PMA_backquote($key) . ' = ' . $funcs[$encoded_key] . '(), '; } else { $valuelist .= PMA_backquote($key) . ' = ' . $funcs[$encoded_key] . "($val), "; } } } // end while // Builds the sql update query $valuelist = ereg_replace(', $', '', $valuelist); if (!empty($valuelist)) { PMA_mysql_select_db($db); $query = 'UPDATE ' . PMA_backquote($table) . ' SET ' . $valuelist . ' WHERE' . $primary_key . ((PMA_MYSQL_INT_VERSION >= 32300) ? ' LIMIT 1' : ''); $message = $strAffectedRows . ' '; } // No change -> move back to the calling script else { $message = $strNoModification; if ($is_gotofile) { $js_to_run = 'functions.js'; include('./header.inc.php'); include('./' . ereg_replace('\.\.*', '.', $goto)); } else { header('Location: ' . $cfg['PmaAbsoluteUri'] . $goto . '&disp_message=' . urlencode($message) . '&disp_query='); } exit(); } } // end row update /** * Prepares the insert of a row */ else { PMA_mysql_select_db($db); $fieldlist = ''; $valuelist = ''; // garvin: Get, if sent, any protected fields to insert them here: if (isset($fields_type) && is_array($fields_type) && isset($primary_key)) { $prot_local_query = 'SELECT * FROM ' . PMA_backquote($table) . ' WHERE ' . urldecode($primary_key); $prot_result = PMA_mysql_query($prot_local_query) or PMA_mysqlDie('', $prot_local_query, '', $err_url); $prot_row = PMA_mysql_fetch_array($prot_result); } while (list($key, $val) = each($fields)) { $encoded_key = $key; $key = urldecode($key); $fieldlist .= PMA_backquote($key) . ', '; include('./tbl_replace_fields.php'); if (empty($funcs[$encoded_key])) { $valuelist .= $val . ', '; } else if (($val == '\'\'' && ereg('^(UNIX_TIMESTAMP|RAND|LAST_INSERT_ID)$', $funcs[$encoded_key])) || ereg('^(NOW|CURDATE|CURTIME|USER)$', $funcs[$encoded_key])) { $valuelist .= $funcs[$encoded_key] . '(), '; } else { $valuelist .= $funcs[$encoded_key] . '(' . $val . '), '; } } // end while // Builds the sql insert query $fieldlist = ereg_replace(', $', '', $fieldlist); $valuelist = ereg_replace(', $', '', $valuelist); $query = 'INSERT INTO ' . PMA_backquote($table) . ' (' . $fieldlist . ') VALUES (' . $valuelist . ')'; $message = $strInsertedRows . ' '; } // end row insertion /** * Executes the sql query and get the result, then move back to the calling * page */ $sql_query = $query . ';'; $result = PMA_mysql_query($query); if (!$result) { $error = PMA_mysql_error(); include('./header.inc.php'); PMA_mysqlDie($error, '', '', $err_url); } else { if (@mysql_affected_rows()) { $message .= @mysql_affected_rows(); } else { $message = $strModifications; } $insert_id = mysql_insert_id(); if ($insert_id != 0) { $message .= '
'.$strInsertedRowId . ' ' . $insert_id; } if ($is_gotofile) { if ($goto == 'db_details.php' && !empty($table)) { unset($table); } $js_to_run = 'functions.js'; $active_page = $goto; include('./header.inc.php'); include('./' . ereg_replace('\.\.*', '.', $goto)); } else { // I don't understand this one: //$add_query = (strpos(' ' . $goto, 'tbl_change') ? '&disp_query=' . urlencode($sql_query) : ''); // if we have seen binary, // we do not append the query to the Location so it won't be displayed // on the resulting page // Nijel: we also need to limit size of url... $add_query = (!$seen_binary && strlen($sql_query) < 1024 ? '&disp_query=' . urlencode($sql_query) : ''); header('Location: ' . $cfg['PmaAbsoluteUri'] . $goto . '&disp_message=' . urlencode($message) . $add_query); } exit(); } // end if ?>