fixed some inconcistancies if an update is required but the record can't be found

This commit is contained in:
Loïc Chapeaux
2001-10-17 15:11:44 +00:00
parent f5c9a8991e
commit 3e345622ea
2 changed files with 6 additions and 4 deletions

View File

@@ -43,6 +43,10 @@ if (isset($primary_key)) {
$local_query = 'SELECT * FROM ' . backquote($table) . ' WHERE ' . $primary_key;
$result = mysql_query($local_query) or mysql_die('', $local_query, '', $err_url);
$row = mysql_fetch_array($result);
if (!$row) {
unset($row);
unset($primary_key);
}
}
else
{
@@ -140,10 +144,6 @@ for ($i = 0; $i < $fields_cnt; $i++) {
$special_chars = htmlspecialchars($row[$field]);
$data = $row[$field];
$backup_field = '<input type="hidden" name="fields_prev[' . urlencode($field) . ']" value="' . urlencode($data) . '" />';
} else if (isset($primary_key)) {
$special_chars = 'NULL';
$data = '';
$backup_field = '<input type="hidden" name="fields_prev[' . urlencode($field) . ']" value="NULL" />';
} else {
// loic1: display default values
if (!isset($row_table_def['Default'])) {