insert a row if BLOB is empty
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* f i e l d u p l o a d e d f r o m a f i l e
|
* handle field values (possibly uploaded from a file)
|
||||||
*
|
*
|
||||||
* garvin: original if-clause checked, whether input was stored in a possible
|
* garvin: original if-clause checked, whether input was stored in a possible
|
||||||
* fields_upload_XX var. Now check, if the field is set. If it is empty or a
|
* fields_upload_XX var. Now check, if the field is set. If it is empty or a
|
||||||
|
@@ -223,7 +223,10 @@ foreach ($loop_array as $primary_key) {
|
|||||||
// i n s e r t
|
// i n s e r t
|
||||||
if ($is_insert) {
|
if ($is_insert) {
|
||||||
// no need to add column into the valuelist
|
// no need to add column into the valuelist
|
||||||
|
if (strlen($cur_value)) {
|
||||||
$query_values[] = $cur_value;
|
$query_values[] = $cur_value;
|
||||||
|
$query_fields[] = PMA_backquote($key);
|
||||||
|
}
|
||||||
|
|
||||||
// u p d a t e
|
// u p d a t e
|
||||||
} elseif (!empty($me_fields_null_prev[$key])
|
} elseif (!empty($me_fields_null_prev[$key])
|
||||||
@@ -265,10 +268,6 @@ unset($me_fields_prev, $me_funcs, $me_fields_type, $me_fields_null, $me_fields_n
|
|||||||
|
|
||||||
// Builds the sql query
|
// Builds the sql query
|
||||||
if ($is_insert && count($value_sets) > 0) {
|
if ($is_insert && count($value_sets) > 0) {
|
||||||
// first inserted row -> prepare template
|
|
||||||
foreach ($me_fields as $key => $val) {
|
|
||||||
$query_fields[] = PMA_backquote($key);
|
|
||||||
}
|
|
||||||
$query[] = 'INSERT INTO ' . PMA_backquote($GLOBALS['db']) . '.' . PMA_backquote($GLOBALS['table'])
|
$query[] = 'INSERT INTO ' . PMA_backquote($GLOBALS['db']) . '.' . PMA_backquote($GLOBALS['table'])
|
||||||
. ' (' . implode(', ', $query_fields) . ') VALUES (' . implode('), (', $value_sets) . ')';
|
. ' (' . implode(', ', $query_fields) . ') VALUES (' . implode('), (', $value_sets) . ')';
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user