tried to fix some "NULL" value problems

This commit is contained in:
Loïc Chapeaux
2001-08-27 23:26:09 +00:00
parent 47397519bd
commit 7161a08252
5 changed files with 30 additions and 6 deletions

View File

@@ -6,8 +6,8 @@ $Id$
$Source$
2001-08-27 Olivier M<>ller <om@omnis.ch>
* tbl_replace.php3: fixed the fact that the function were
ignored if the data remained unchanged.
* tbl_replace.php3: fixed the fact that the function were ignored if the
data remained unchanged.
2001-08-27 Lo<4C>c Chapeaux <lolo@phpheaven.net>
* lib.inc.php3: fixed some coding style inconcistencies.
@@ -20,13 +20,16 @@ $Source$
* lang/romanian.inc.php3: put all the string to translate at the end and
added a missing one.
* lang/dutch.inc.php3: sorted the strings.
* tbl_addfield.php3, lines 32-41; tbl_alter.php3, lines 48-54;
tbl_properties.php3, lines 222-228; tbl_properties.inc.php3,
lines 152-158: tried to fix the "NULL" value problem.
2001-08-27 Marc Delisle <lem9@users.sourceforge.net>
* lang/dutch.inc.php3 updates, thanks to Arjen Roodselaar.
* tbl_copy.php3, eregi_replace instead of ereg_replace because
MySQL 3.23.20 returns sql keywords in lowercase, thanks to
Jan Paul Schmidt.
* lang/romanian.inc.php3, select_lang.inc.php3: new romanian lang
* lang/romanian.inc.php3, select_lang.inc.php3: new romanian lang thanks to
thanks to Valics Lehel (lvalics@users.sourceforge.net).
2001-08-25 Marc Delisle <lem9@users.sourceforge.net>

View File

@@ -30,7 +30,10 @@ if (isset($submit)) {
$query .= ' ' . $field_attribute[$i];
}
if ($field_default[$i] != '') {
if (get_magic_quotes_gpc()) {
if (strtoupper($field_default[$i]) == 'NULL') {
$query .= ' DEFAULT NULL';
}
else if (get_magic_quotes_gpc()) {
$query .= ' DEFAULT \'' . sql_addslashes(stripslashes($field_default[$i])) . '\'';
} else {
$query .= ' DEFAULT \'' . sql_addslashes($field_default[$i]) . '\'';

View File

@@ -46,7 +46,11 @@ if (isset($submit)) {
$query .= ' ' . $field_attribute[0];
}
if ($field_default[0] != '') {
$query .= ' DEFAULT \'' . sql_addslashes($field_default[0]) . '\'';
if (strtoupper($field_default[0]) == 'NULL') {
$query .= ' DEFAULT NULL';
} else {
$query .= ' DEFAULT \'' . sql_addslashes($field_default[0]) . '\'';
}
}
if ($field_null[0] != '') {
$query .= ' ' . $field_null[0];

View File

@@ -149,6 +149,13 @@ for ($i = 0 ; $i < $num_fields; $i++) {
?>
</select>
</td>
<?php
if (isset($row)
&& !isset($row['Default']) && !empty($row['Null'])) {
$row['Default'] = 'NULL';
}
echo "\n";
?>
<td>
<input type="hidden" name="field_default_orig[]" size="8" value="<?php if(isset($row) && isset($row['Default'])) echo urlencode($row['Default']); ?>" />
<input type="text" name="field_default[]" size="8" value="<?php if(isset($row) && isset($row['Default'])) echo str_replace('"', '&quot;', $row['Default']); ?>" />

View File

@@ -219,6 +219,13 @@ while ($row = mysql_fetch_array($result)) {
if ($zerofill) {
$strAttribute = 'UNSIGNED ZEROFILL';
}
if (!isset($row['Default'])) {
if ($row['Null'] != '') {
$row['Default'] = '<i>NULL</i>';
}
} else {
$row['Default'] = htmlspecialchars($row['Default']);
}
echo "\n";
?>
<tr bgcolor="<?php echo $bgcolor; ?>">
@@ -226,7 +233,7 @@ while ($row = mysql_fetch_array($result)) {
<td<?php echo $type_nowrap; ?>><?php echo $type; ?></td>
<td nowrap="nowrap"><?php echo $strAttribute; ?></td>
<td><?php echo (($row['Null'] == '') ? $strNo : $strYes); ?>&nbsp;</td>
<td nowrap="nowrap"><?php if (isset($row['Default'])) echo htmlspecialchars($row['Default']); ?>&nbsp;</td>
<td nowrap="nowrap"><?php if (isset($row['Default'])) echo $row['Default']; ?>&nbsp;</td>
<td nowrap="nowrap"><?php echo $row['Extra']; ?>&nbsp;</td>
<?php
if (empty($printer_friendly)) {