restored default value to "NOW()" with timestamp fields in an "UPDATE" statement

This commit is contained in:
Loïc Chapeaux
2002-02-24 12:06:37 +00:00
parent 6a6ac9ba06
commit e7508db91c
2 changed files with 16 additions and 21 deletions

View File

@@ -7,6 +7,8 @@ $Source$
2002-02-24 Lo<4C>c Chapeaux <lolo@phpheaven.net> 2002-02-24 Lo<4C>c Chapeaux <lolo@phpheaven.net>
* lang/german.inc.php3: updated thanks to Alexander M. Turek. * lang/german.inc.php3: updated thanks to Alexander M. Turek.
* tbl_change.php3: restored default value to "NOW()" with timestamp fields
in an "UPDATE" statement.
2002-02-23 Marc Delisle <lem9@users.sourceforge.net> 2002-02-23 Marc Delisle <lem9@users.sourceforge.net>
* swedish updates thanks to Bj<42>rn T. Hallberg * swedish updates thanks to Bj<42>rn T. Hallberg

View File

@@ -152,9 +152,8 @@ if ($cfgShowFunctionFields) {
</tr> </tr>
<?php <?php
// Set if we passed the first timestamp field (loic1: in insert mode only -not // Set if we passed the first timestamp field
// in edit mode-) $timestamp_seen = 0;
$timestamp_seen = (isset($primary_key) ? 1 : 0);
$fields_cnt = mysql_num_rows($table_def); $fields_cnt = mysql_num_rows($table_def);
for ($i = 0; $i < $fields_cnt; $i++) { for ($i = 0; $i < $fields_cnt; $i++) {
@@ -262,29 +261,23 @@ for ($i = 0; $i < $fields_cnt; $i++) {
<option></option> <option></option>
<?php <?php
echo "\n"; echo "\n";
if (!$first_timestamp) { $selected = '';
for ($j = 0; $j < count($cfgFunctions); $j++) { for ($j = 0; $j < count($cfgFunctions); $j++) {
echo ' '; // for default function = NOW() on first timestamp field
echo '<option>' . $cfgFunctions[$j] . '</option>' . "\n"; // -- swix/18jul01
} $selected = ($first_timestamp && $cfgFunctions[$j] == 'NOW')
} else { ? ' selected="selected"'
// for default function = NOW() on first timestamp field : '';
// -- swix/18jul01 echo ' ';
for ($j = 0; $j < count($cfgFunctions); $j++) { echo '<option' . $selected . '>' . $cfgFunctions[$j] . '</option>' . "\n";
echo ' '; } // end for
if ($cfgFunctions[$j] == 'NOW') { unset($selected);
echo '<option selected="selected">' . $cfgFunctions[$j] . '</option>' . "\n";
} else {
echo '<option>' . $cfgFunctions[$j] . '</option>' . "\n";
}
} // end for
}
?> ?>
</select> </select>
</td> </td>
<?php <?php
} }
} } // end if ($cfgShowFunctionFields)
echo "\n"; echo "\n";
// The null column // The null column