delete unnecessary ordering in sql statements

This commit is contained in:
Lukas Heiligenbrunner 2020-07-31 01:05:58 +02:00
parent a2385e8e4c
commit 08df6d64dd
2 changed files with 3 additions and 9 deletions

View File

@ -7,9 +7,6 @@ class Settings extends RequestBase {
$query = "SELECT * from settings"; $query = "SELECT * from settings";
$result = $this->conn->query($query); $result = $this->conn->query($query);
if ($result->num_rows > 1) {
// todo throw error
}
$r = mysqli_fetch_assoc($result); $r = mysqli_fetch_assoc($result);
// booleans need to be set manually // booleans need to be set manually
@ -45,9 +42,6 @@ class Settings extends RequestBase {
$query = "SELECT * from settings"; $query = "SELECT * from settings";
$result = $this->conn->query($query); $result = $this->conn->query($query);
if ($result->num_rows > 1) {
// todo throw error
}
$r = mysqli_fetch_assoc($result); $r = mysqli_fetch_assoc($result);
if ($r['password'] != "-1") { if ($r['password'] != "-1") {

View File

@ -14,7 +14,7 @@ class Video extends RequestBase {
function initHandlers() { function initHandlers() {
$this->addActionHandler("getMovies", function () { $this->addActionHandler("getMovies", function () {
$query = "SELECT movie_id,movie_name FROM videos ORDER BY create_date DESC, movie_name ASC"; $query = "SELECT movie_id,movie_name FROM videos ORDER BY create_date DESC, movie_name";
if (isset($_POST['tag'])) { if (isset($_POST['tag'])) {
$tag = $_POST['tag']; $tag = $_POST['tag'];
if ($_POST['tag'] != "all") { if ($_POST['tag'] != "all") {
@ -22,7 +22,7 @@ class Video extends RequestBase {
INNER JOIN video_tags vt on videos.movie_id = vt.video_id INNER JOIN video_tags vt on videos.movie_id = vt.video_id
INNER JOIN tags t on vt.tag_id = t.tag_id INNER JOIN tags t on vt.tag_id = t.tag_id
WHERE t.tag_name = '$tag' WHERE t.tag_name = '$tag'
ORDER BY likes DESC, create_date ASC, movie_name ASC"; ORDER BY likes DESC, create_date, movie_name";
} }
} }
$result = $this->conn->query($query); $result = $this->conn->query($query);
@ -67,7 +67,7 @@ class Video extends RequestBase {
$query = "SELECT movie_id,movie_name FROM videos $query = "SELECT movie_id,movie_name FROM videos
WHERE movie_name LIKE '%$search%' WHERE movie_name LIKE '%$search%'
ORDER BY likes DESC, create_date DESC, movie_name ASC"; ORDER BY likes DESC, create_date DESC, movie_name";
$result = $this->conn->query($query); $result = $this->conn->query($query);
$rows = array(); $rows = array();
while ($r = mysqli_fetch_assoc($result)) { while ($r = mysqli_fetch_assoc($result)) {