ignore empty fields

This commit is contained in:
Marc Delisle
2001-06-16 00:28:54 +00:00
parent e0842e29d2
commit c53098f2d4
2 changed files with 15 additions and 6 deletions

View File

@@ -7,6 +7,7 @@ $Source$
2001-06-15 Marc Delisle <lem9@users.sourceforge.net>
* bug 433388, patch from Alain Brissaud (hal0802)
* feature 429767, ignore empty fields on table create (tbl_create.php3)
2001-06-14 Steve Alberty <alberty@neptunlabs.de>
* add support for locked tables (default=off)

View File

@@ -13,6 +13,9 @@ if(isset($submit))
$query = "";
for($i=0; $i<count($field_name); $i++)
{
if (empty($field_name[$i])) {
continue;
}
$query .= "$field_name[$i] $field_type[$i] ";
if($field_length[$i] != "")
if(get_magic_quotes_gpc()) {
@@ -41,6 +44,7 @@ if(isset($submit))
for($i=0;$i<count($field_primary);$i++)
{
$j = $field_primary[$i];
if (!empty($field_name[$j]))
$primary .= "$field_name[$j], ";
}
$primary = ereg_replace(", $", "", $primary);
@@ -56,10 +60,12 @@ if(isset($submit))
for($i=0;$i<count($field_index);$i++)
{
$j = $field_index[$i];
if (!empty($field_name[$j]))
$index .= "$field_name[$j], ";
}
$index = ereg_replace(", $", "", $index);
if(count($field_index) > 0)
// if(count($field_index) > 0)
if(!empty($index))
$index = ", INDEX ($index)";
if(!isset($unique))
$unique = "";
@@ -70,10 +76,12 @@ if(isset($submit))
for($i=0;$i<count($field_unique);$i++)
{
$j = $field_unique[$i];
if (!empty($field_name[$j]))
$unique .= "$field_name[$j], ";
}
$unique = ereg_replace(", $", "", $unique);
if(count($field_unique) > 0)
// if(count($field_unique) > 0)
if(!empty($unique))
$unique = ", UNIQUE ($unique)";
$query_keys = $primary.$index.$unique;
$query_keys = ereg_replace(", $", "", $query_keys);