ignore empty fields
This commit is contained in:
@@ -7,6 +7,7 @@ $Source$
|
|||||||
|
|
||||||
2001-06-15 Marc Delisle <lem9@users.sourceforge.net>
|
2001-06-15 Marc Delisle <lem9@users.sourceforge.net>
|
||||||
* bug 433388, patch from Alain Brissaud (hal0802)
|
* 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>
|
2001-06-14 Steve Alberty <alberty@neptunlabs.de>
|
||||||
* add support for locked tables (default=off)
|
* add support for locked tables (default=off)
|
||||||
|
@@ -13,6 +13,9 @@ if(isset($submit))
|
|||||||
$query = "";
|
$query = "";
|
||||||
for($i=0; $i<count($field_name); $i++)
|
for($i=0; $i<count($field_name); $i++)
|
||||||
{
|
{
|
||||||
|
if (empty($field_name[$i])) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
$query .= "$field_name[$i] $field_type[$i] ";
|
$query .= "$field_name[$i] $field_type[$i] ";
|
||||||
if($field_length[$i] != "")
|
if($field_length[$i] != "")
|
||||||
if(get_magic_quotes_gpc()) {
|
if(get_magic_quotes_gpc()) {
|
||||||
@@ -41,6 +44,7 @@ if(isset($submit))
|
|||||||
for($i=0;$i<count($field_primary);$i++)
|
for($i=0;$i<count($field_primary);$i++)
|
||||||
{
|
{
|
||||||
$j = $field_primary[$i];
|
$j = $field_primary[$i];
|
||||||
|
if (!empty($field_name[$j]))
|
||||||
$primary .= "$field_name[$j], ";
|
$primary .= "$field_name[$j], ";
|
||||||
}
|
}
|
||||||
$primary = ereg_replace(", $", "", $primary);
|
$primary = ereg_replace(", $", "", $primary);
|
||||||
@@ -56,10 +60,12 @@ if(isset($submit))
|
|||||||
for($i=0;$i<count($field_index);$i++)
|
for($i=0;$i<count($field_index);$i++)
|
||||||
{
|
{
|
||||||
$j = $field_index[$i];
|
$j = $field_index[$i];
|
||||||
|
if (!empty($field_name[$j]))
|
||||||
$index .= "$field_name[$j], ";
|
$index .= "$field_name[$j], ";
|
||||||
}
|
}
|
||||||
$index = ereg_replace(", $", "", $index);
|
$index = ereg_replace(", $", "", $index);
|
||||||
if(count($field_index) > 0)
|
// if(count($field_index) > 0)
|
||||||
|
if(!empty($index))
|
||||||
$index = ", INDEX ($index)";
|
$index = ", INDEX ($index)";
|
||||||
if(!isset($unique))
|
if(!isset($unique))
|
||||||
$unique = "";
|
$unique = "";
|
||||||
@@ -70,10 +76,12 @@ if(isset($submit))
|
|||||||
for($i=0;$i<count($field_unique);$i++)
|
for($i=0;$i<count($field_unique);$i++)
|
||||||
{
|
{
|
||||||
$j = $field_unique[$i];
|
$j = $field_unique[$i];
|
||||||
|
if (!empty($field_name[$j]))
|
||||||
$unique .= "$field_name[$j], ";
|
$unique .= "$field_name[$j], ";
|
||||||
}
|
}
|
||||||
$unique = ereg_replace(", $", "", $unique);
|
$unique = ereg_replace(", $", "", $unique);
|
||||||
if(count($field_unique) > 0)
|
// if(count($field_unique) > 0)
|
||||||
|
if(!empty($unique))
|
||||||
$unique = ", UNIQUE ($unique)";
|
$unique = ", UNIQUE ($unique)";
|
||||||
$query_keys = $primary.$index.$unique;
|
$query_keys = $primary.$index.$unique;
|
||||||
$query_keys = ereg_replace(", $", "", $query_keys);
|
$query_keys = ereg_replace(", $", "", $query_keys);
|
||||||
|
Reference in New Issue
Block a user