From: Roland Häder Date: Mon, 15 Sep 2008 03:18:25 +0000 (+0000) Subject: Queries improved X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=89edd713e330fd16e8da1edeadfd5046296ff0d2;p=mailer.git Queries improved --- diff --git a/inc/databases.php b/inc/databases.php index 107b52e112..4084010844 100644 --- a/inc/databases.php +++ b/inc/databases.php @@ -114,7 +114,7 @@ define('USAGE_BASE', "usage"); define('SERVER_URL', "http://www.mxchange.org"); // This current patch level -define('CURR_SVN_REVISION', "334"); +define('CURR_SVN_REVISION', "335"); // Take a prime number which is long (if you know a longer one please try it out!) define('_PRIME', 591623); diff --git a/inc/libs/sponsor_functions.php b/inc/libs/sponsor_functions.php index 3b17afa3ff..e9df50e78b 100644 --- a/inc/libs/sponsor_functions.php +++ b/inc/libs/sponsor_functions.php @@ -365,7 +365,7 @@ ORDER BY sort", __FILE__, __LINE__); { // Load sub menus $result_sub = SQL_QUERY_ESC("SELECT what, title FROM "._MYSQL_PREFIX."_sponsor_menu -WHERE action='%s' AND what != '' ".$WHERE." +WHERE action='%s' AND what != '' AND what IS NOT NULL ".$WHERE." ORDER BY sort", array($action), __FILE__, __LINE__); if (SQL_NUMROWS($result_sub) > 0) { diff --git a/inc/modules/admin/admin-inc.php b/inc/modules/admin/admin-inc.php index 822836ff9b..a0700817fe 100644 --- a/inc/modules/admin/admin-inc.php +++ b/inc/modules/admin/admin-inc.php @@ -447,7 +447,7 @@ function ADD_ADMIN_MENU($act, $wht,$return=false) } $OUT .= " \n"; - $result_what = SQL_QUERY_ESC("SELECT what, title, descr FROM "._MYSQL_PREFIX."_admin_menu WHERE action='%s' AND what != '' ORDER BY sort, id DESC", + $result_what = SQL_QUERY_ESC("SELECT what, title, descr FROM "._MYSQL_PREFIX."_admin_menu WHERE action='%s' AND what != '' AND what IS NOT NULL ORDER BY sort, id DESC", array($menu), __FILE__, __LINE__); if ((SQL_NUMROWS($result_what) > 0) && ($act == $menu)) { diff --git a/inc/modules/admin/what-admin_add.php b/inc/modules/admin/what-admin_add.php index 7907f4c4e2..385600b139 100644 --- a/inc/modules/admin/what-admin_add.php +++ b/inc/modules/admin/what-admin_add.php @@ -90,7 +90,7 @@ if (!isset($_POST['ok'])) // Load sub menus :) foreach ($menus as $key_main => $value_main) { - $result = SQL_QUERY_ESC("SELECT what, title, sort FROM "._MYSQL_PREFIX."_admin_menu WHERE action='%s' AND what != '' ORDER BY sort", + $result = SQL_QUERY_ESC("SELECT what, title, sort FROM "._MYSQL_PREFIX."_admin_menu WHERE action='%s' AND what != '' AND what IS NOT NULL ORDER BY sort", array($value_main), __FILE__, __LINE__); if (SQL_NUMROWS($result) > 0) { diff --git a/inc/modules/admin/what-adminedit.php b/inc/modules/admin/what-adminedit.php index 562040fcce..d0014a7e57 100644 --- a/inc/modules/admin/what-adminedit.php +++ b/inc/modules/admin/what-adminedit.php @@ -235,7 +235,7 @@ WHERE ".$AND." AND id=%s LIMIT 1", if (!empty($SUB)) { // Sub menus of a main menu - $result = SQL_QUERY_ESC("SELECT id, action, what, title, sort FROM "._MYSQL_PREFIX."_admin_menu WHERE action='%s' AND what != '' ORDER BY sort ASC", + $result = SQL_QUERY_ESC("SELECT id, action, what, title, sort FROM "._MYSQL_PREFIX."_admin_menu WHERE action='%s' AND what != '' AND what IS NOT NULL ORDER BY sort ASC", array($SUB), __FILE__, __LINE__); } else diff --git a/inc/modules/admin/what-config_home.php b/inc/modules/admin/what-config_home.php index 28f5952201..64bcfd3b71 100644 --- a/inc/modules/admin/what-config_home.php +++ b/inc/modules/admin/what-config_home.php @@ -77,7 +77,7 @@ case "target": // Set which what-file will be placed in home-page (only modules. // Load all what menu points $result = SQL_QUERY("SELECT id, what, title FROM "._MYSQL_PREFIX."_guest_menu - WHERE action='main' AND what != '' AND locked='N' + WHERE action='main' AND what != '' AND what IS NOT NULL AND locked='N' ORDER BY sort", __FILE__, __LINE__); $SW = 2; $OUT = ""; $atitle = ""; diff --git a/inc/modules/admin/what-guest_add.php b/inc/modules/admin/what-guest_add.php index e5f22c6b9d..43b83fa339 100644 --- a/inc/modules/admin/what-guest_add.php +++ b/inc/modules/admin/what-guest_add.php @@ -92,7 +92,7 @@ if (!isset($_POST['ok'])) { $result = SQL_QUERY_ESC("SELECT what, title, sort FROM "._MYSQL_PREFIX."_guest_menu -WHERE action='%s' AND what != '' ORDER BY sort", +WHERE action='%s' AND what != '' AND what IS NOT NULL ORDER BY sort", array(bigintval($value_main)), __FILE__, __LINE__); if (SQL_NUMROWS($result) > 0) { diff --git a/inc/modules/admin/what-guestedit.php b/inc/modules/admin/what-guestedit.php index d27a0f11c5..60241a0712 100644 --- a/inc/modules/admin/what-guestedit.php +++ b/inc/modules/admin/what-guestedit.php @@ -292,7 +292,7 @@ if ((isset($_POST['edit'])) && ($chk > 0) && (!IS_DEMO())) else { // List sub menus - $query = SQL_QUERY_ESC("SELECT id, action, what, title, sort FROM "._MYSQL_PREFIX."_guest_menu WHERE action='%s' AND what != '' ORDER BY sort ASC", + $query = SQL_QUERY_ESC("SELECT id, action, what, title, sort FROM "._MYSQL_PREFIX."_guest_menu WHERE action='%s' AND what != '' AND what IS NOT NULL ORDER BY sort ASC", array($SUB), __FILE__, __LINE__); } diff --git a/inc/modules/admin/what-memedit.php b/inc/modules/admin/what-memedit.php index c89ebba365..b9b8546a57 100644 --- a/inc/modules/admin/what-memedit.php +++ b/inc/modules/admin/what-memedit.php @@ -262,7 +262,7 @@ if ((isset($_POST['edit'])) && ($chk > 0) && (!IS_DEMO())) if (!empty($SUB)) { // Edit sub menus - $result = SQL_QUERY("SELECT id, action, what, title, sort FROM "._MYSQL_PREFIX."_member_menu WHERE ".$AND." AND what != '' ORDER BY sort ASC", __FILE__, __LINE__); + $result = SQL_QUERY("SELECT id, action, what, title, sort FROM "._MYSQL_PREFIX."_member_menu WHERE ".$AND." AND what != '' AND what IS NOT NULL ORDER BY sort ASC", __FILE__, __LINE__); } else { diff --git a/inc/modules/admin/what-repair_amenu.php b/inc/modules/admin/what-repair_amenu.php index 34f4382be8..399570831c 100644 --- a/inc/modules/admin/what-repair_amenu.php +++ b/inc/modules/admin/what-repair_amenu.php @@ -62,7 +62,7 @@ $result_sort = SQL_QUERY("UPDATE "._MYSQL_PREFIX."_admin_menu SET sort='999' WHE // Now sort every each menu foreach ($ACTIONS as $act) { - $result_fix = SQL_QUERY("SELECT id FROM "._MYSQL_PREFIX."_admin_menu WHERE act='".$act."' AND what != '' ORDER BY sort", __FILE__, __LINE__); + $result_fix = SQL_QUERY("SELECT id FROM "._MYSQL_PREFIX."_admin_menu WHERE act='".$act."' AND what != '' AND what IS NOT NULL ORDER BY sort", __FILE__, __LINE__); $cnt = 1; while (list($id) = SQL_FETCHROW($result_fix)) { diff --git a/inc/modules/admin/what-repair_amnu.php b/inc/modules/admin/what-repair_amnu.php index 75872b180c..eeb47245f8 100644 --- a/inc/modules/admin/what-repair_amnu.php +++ b/inc/modules/admin/what-repair_amnu.php @@ -67,7 +67,7 @@ $result_sort = SQL_QUERY("UPDATE "._MYSQL_PREFIX."_admin_menu SET sort='999' WHE // Now sort every each menu foreach ($ACTIONs as $act) { - $result_fix = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_admin_menu WHERE action='%s' AND what != '' ORDER BY sort", + $result_fix = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_admin_menu WHERE action='%s' AND what != '' AND what IS NOT NULL ORDER BY sort", array($act), __FILE__, __LINE__); $cnt = 1; while (list($id) = SQL_FETCHROW($result_fix)) diff --git a/inc/modules/admin/what-repair_gmenu.php b/inc/modules/admin/what-repair_gmenu.php index 6859336b8c..1eb582f32d 100644 --- a/inc/modules/admin/what-repair_gmenu.php +++ b/inc/modules/admin/what-repair_gmenu.php @@ -62,7 +62,7 @@ $result_sort = SQL_QUERY("UPDATE "._MYSQL_PREFIX."_guest_menu SET sort='999' WHE // Now sort every each menu foreach ($ACTIONS as $act) { - $result_fix = SQL_QUERY("SELECT id FROM "._MYSQL_PREFIX."_guest_menu WHERE act='".$act."' AND what != '' ORDER BY sort", __FILE__, __LINE__); + $result_fix = SQL_QUERY("SELECT id FROM "._MYSQL_PREFIX."_guest_menu WHERE act='".$act."' AND what != '' AND what IS NOT NULL ORDER BY sort", __FILE__, __LINE__); $cnt = 1; while (list($id) = SQL_FETCHROW($result_fix)) { diff --git a/inc/modules/admin/what-repair_gmnu.php b/inc/modules/admin/what-repair_gmnu.php index 80ac7ca7c0..6353330c87 100644 --- a/inc/modules/admin/what-repair_gmnu.php +++ b/inc/modules/admin/what-repair_gmnu.php @@ -67,7 +67,7 @@ $result_sort = SQL_QUERY("UPDATE "._MYSQL_PREFIX."_guest_menu SET sort='999' WHE // Now sort every each menu foreach ($ACTIONS as $act) { - $result_fix = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_guest_menu WHERE action='%s' AND what != '' ORDER BY sort", + $result_fix = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_guest_menu WHERE action='%s' AND what != '' AND what IS NOT NULL ORDER BY sort", array($act), __FILE__, __LINE__); $cnt = 1; diff --git a/inc/modules/admin/what-repair_mmenu.php b/inc/modules/admin/what-repair_mmenu.php index 23d67de7f2..320d3c49b3 100644 --- a/inc/modules/admin/what-repair_mmenu.php +++ b/inc/modules/admin/what-repair_mmenu.php @@ -62,7 +62,7 @@ $result_sort = SQL_QUERY("UPDATE "._MYSQL_PREFIX."_member_menu SET sort='999' WH // Now sort every each menu foreach ($ACTIONS as $act) { - $result_fix = SQL_QUERY("SELECT id FROM "._MYSQL_PREFIX."_member_menu WHERE action='".$act."' AND what != '' ORDER BY sort", __FILE__, __LINE__); + $result_fix = SQL_QUERY("SELECT id FROM "._MYSQL_PREFIX."_member_menu WHERE action='".$act."' AND what != '' AND what IS NOT NULL ORDER BY sort", __FILE__, __LINE__); $cnt = 1; while (list($id) = SQL_FETCHROW($result_fix)) { diff --git a/inc/modules/admin/what-repair_mmnu.php b/inc/modules/admin/what-repair_mmnu.php index 81d3ade161..4e042f9812 100644 --- a/inc/modules/admin/what-repair_mmnu.php +++ b/inc/modules/admin/what-repair_mmnu.php @@ -67,7 +67,7 @@ $result_sort = SQL_QUERY("UPDATE "._MYSQL_PREFIX."_member_menu SET sort='999' WH // Now sort every each menu foreach ($ACTIONS as $act) { - $result_fix = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_member_menu WHERE action='%s' AND what != '' ORDER BY sort", + $result_fix = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_member_menu WHERE action='%s' AND what != '' AND what IS NOT NULL ORDER BY sort", array($act), __FILE__, __LINE__); $cnt = 1; while (list($id) = SQL_FETCHROW($result_fix)) diff --git a/inc/mysql-manager.php b/inc/mysql-manager.php index eba75b197f..756e52d3b3 100644 --- a/inc/mysql-manager.php +++ b/inc/mysql-manager.php @@ -342,7 +342,7 @@ function ADD_MENU($MODE, $act, $wht) { // Load menu header template LOAD_TEMPLATE($MODE."_menu_title", false, $content); - $result_sub = SQL_QUERY_ESC("SELECT title, what FROM "._MYSQL_PREFIX."_%s_menu WHERE action='%s' AND what != '' ".$AND." ORDER BY sort", + $result_sub = SQL_QUERY_ESC("SELECT title, what FROM "._MYSQL_PREFIX."_%s_menu WHERE action='%s' AND what != '' AND what IS NOT NULL".$AND." ORDER BY sort", array($MODE, $main_action), __FILE__, __LINE__); $ctl = SQL_NUMROWS($result_sub); if ($ctl > 0) {