Insert - swap order

This commit is contained in:
Garvin Hicking
2003-08-05 17:48:36 +00:00
parent 7204e154e9
commit bc01b8cb75
2 changed files with 19 additions and 6 deletions

View File

@@ -10,6 +10,7 @@ $Source$
(Bug #782966) (Bug #782966)
* tbl_change.php3: RFE #772991: Shorten dropdown field using * tbl_change.php3: RFE #772991: Shorten dropdown field using
$cfg['LimitChars'] $cfg['LimitChars']
* tbl_change.php3: RFE #762221: Swap relational insert key order
2003-08-05 Michal Cihar <nijel@users.sourceforge.net> 2003-08-05 Michal Cihar <nijel@users.sourceforge.net>
* sql.php3: Fixed regular expression. * sql.php3: Fixed regular expression.

View File

@@ -438,26 +438,38 @@ for ($i = 0; $i < $fields_cnt; $i++) {
<option value=""></option> <option value=""></option>
<?php <?php
echo "\n"; echo "\n";
$reloptions = array('content-id' => array(), 'id-content' => array());
while ($relrow = @PMA_mysql_fetch_array($disp)) { while ($relrow = @PMA_mysql_fetch_array($disp)) {
$key = $relrow[$foreign_field]; $key = $relrow[$foreign_field];
if (strlen($relrow[$foreign_display]) <= $cfg['LimitChars']) { if (strlen($relrow[$foreign_display]) <= $cfg['LimitChars']) {
$value = (($foreign_display != FALSE) ? '&nbsp;-&nbsp;' . htmlspecialchars($relrow[$foreign_display]) : ''); $value = (($foreign_display != FALSE) ? htmlspecialchars($relrow[$foreign_display]) : '');
$vtitle = ''; $vtitle = '';
} else { } else {
$vtitle = htmlspecialchars($relrow[$foreign_display]); $vtitle = htmlspecialchars($relrow[$foreign_display]);
$value = (($foreign_display != FALSE) ? '&nbsp;-&nbsp;' . htmlspecialchars(substr($vtitle, 0, $cfg['LimitChars']) . '...') : ''); $value = (($foreign_display != FALSE) ? htmlspecialchars(substr($vtitle, 0, $cfg['LimitChars']) . '...') : '');
} }
echo ' <option value="' . htmlspecialchars($key) . '"'; $reloption = ' <option value="' . htmlspecialchars($key) . '"';
if ($vtitle != '') { if ($vtitle != '') {
echo ' title="' . $vtitle . '"'; $reloption .= ' title="' . $vtitle . '"';
} }
if ($key == $data) { if ($key == $data) {
echo ' selected="selected"'; $reloption .= ' selected="selected"';
} // end if } // end if
echo '>' . htmlspecialchars($key) . $value . '</option>' . "\n";
$reloptions['id-content'][] = $reloption . '>' . $value . '&nbsp;-&nbsp;' . htmlspecialchars($key) . '</option>' . "\n";
$reloptions['content-id'][] = $reloption . '>' . htmlspecialchars($key) . '&nbsp;-&nbsp;' . $value . '</option>' . "\n";
} // end while } // end while
if (count($reloptions['content-id']) < 100) {
echo implode('', $reloptions['content-id']);
if (count($reloptions['content-id']) > 0) {
echo ' <option value=""></option>' . "\n";
echo ' <option value=""></option>' . "\n";
}
}
echo implode('', $reloptions['id-content']);
echo ' </select>' . "\n"; echo ' </select>' . "\n";
echo ' </td>' . "\n"; echo ' </td>' . "\n";
unset($disp); unset($disp);