X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=inc%2Fmodules%2Fadmin%2Fwhat-payments.php;h=71dad294d453508ec150b0d1cc3615d5c0a34720;hb=4b9887f734067dc52a1730468e25ba066036a3e1;hp=2860ab6933860b50a393895b9144f64318519700;hpb=a226d81121cb96048b1ed85fd8584a87d435b0db;p=mailer.git diff --git a/inc/modules/admin/what-payments.php b/inc/modules/admin/what-payments.php index 2860ab6933..71dad294d4 100644 --- a/inc/modules/admin/what-payments.php +++ b/inc/modules/admin/what-payments.php @@ -53,27 +53,22 @@ if (isFormSent()) { switch (getRequestParameter('do')) { case 'add': addSql("INSERT INTO `{?_MYSQL_PREFIX?}_payments` (`time`, `payment`, `mail_title`, `price`) VALUES ('".postRequestParameter('t_wait')."','".postRequestParameter('payment')."','".postRequestParameter('title')."','".postRequestParameter('price')."')"); - $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_payments` WHERE `time`='%s' LIMIT 1", - array(postRequestParameter('t_wait')), __FILE__, __LINE__); - if (SQL_NUMROWS($result) == 1) { + if (countSumTotalData(postRequestParameter('t_wait'), 'payments', 'id', 'time', true) == 1) { // Re-init the array here initSqls(); - - // Free memory - SQL_FREERESULT($result); - } + } // END - if break; case 'edit': foreach (postRequestParameter('time') as $id => $value) { - addSql("UPDATE `{?_MYSQL_PREFIX?}_payments` SET `time`='" . $value . "', `payment`='".postRequestParameter('pay', $id)."', price='".postRequestParameter('price', $id)."', mail_title='".postRequestParameter('title', $id)."' WHERE `id`='".$id."' LIMIT 1"); - } + addSql("UPDATE `{?_MYSQL_PREFIX?}_payments` SET `time`='" . $value . "', `payment`='".postRequestParameter('payment', $id)."', price='".postRequestParameter('price', $id)."', mail_title='".postRequestParameter('mail_title', $id)."' WHERE `id`='".$id."' LIMIT 1"); + } // END - foreach break; case 'del': foreach (postRequestParameter('id') as $id => $value) { addSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_payments` WHERE `id`=" . bigintval($id) . " LIMIT 1"); - } + } // END - foreach break; } // END - switch @@ -93,17 +88,12 @@ if (isFormSent()) { // Delete entries here $OUT = ''; foreach (postRequestParameter('sel') as $id => $value) { - $result = SQL_QUERY_ESC("SELECT time, mail_title FROM `{?_MYSQL_PREFIX?}_payments` WHERE `id`=%s LIMIT 1", - array(bigintval($id)), __FILE__, __LINE__); - list($time, $title) = SQL_FETCHROW($result); - SQL_FREERESULT($result); + $result = SQL_QUERY_ESC("SELECT `id`, `time`, `mail_title` FROM `{?_MYSQL_PREFIX?}_payments` WHERE `id`=%s LIMIT 1", + array(bigintval($id)), __FILE__, __LINE__); + $content = SQL_FETCHARRAY($result); - // Prepare array for the row template - $content = array( - 'id' => $id, - 'time' => $time, - 'title' => $title, - ); + // Free result + SQL_FREERESULT($result); // Load row template and switch colors $OUT .= loadTemplate('admin_del_payments_row', true, $content); @@ -115,19 +105,12 @@ if (isFormSent()) { // Edit entries $OUT = ''; foreach (postRequestParameter('sel') as $id => $value) { - $result = SQL_QUERY_ESC("SELECT time, payment, mail_title, price FROM `{?_MYSQL_PREFIX?}_payments` WHERE `id`=%s LIMIT 1", - array(bigintval($id)), __FILE__, __LINE__); - list($time, $pay, $title, $price) = SQL_FETCHROW($result); - SQL_FREERESULT($result); + $result = SQL_QUERY_ESC("SELECT `id`, `time`, `payment`, `mail_title`, `price` FROM `{?_MYSQL_PREFIX?}_payments` WHERE `id`=%s LIMIT 1", + array(bigintval($id)), __FILE__, __LINE__); + $content = SQL_FETCHARRAY($result); - // Prepare array for the row template - $content = array( - 'id' => $id, - 'time' => $time, - 'title' => $title, - 'pay' => $pay, - 'price' => $price, - ); + // Free result + SQL_FREERESULT($result); // Load row template and switch colors $OUT .= loadTemplate('admin_edit_payments_row', true, $content);