com web/master: Need to use LEFT JOIN on last/first 10 notes view since there could be no voting information available.: manage/user-notes.php
| From: | Sherif Ramadan | Date: | Thu, 13 Dec 2012 20:13:47 +0000 |
| Subject: | com web/master: Need to use LEFT JOIN on last/first 10 notes view since there could be no voting information available.: manage/user-notes.php | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-15079@lists.php.net to get a copy of this message | ||
Commit: ab8c0d7719785e7b1c9712e4020106b5816dcc12
Author: Sherif Ramadan <googleguy@php.net> Thu, 13 Dec 2012 15:13:47 -0500
Parents: 889a45f607966f6a238bd9d4ed8209af8f9aa936
Branches: master
Link: http://git.php.net/?p=web/master.git;a=commitdiff;h=ab8c0d7719785e7b1c9712e4020106b5816dcc12
Log:
Need to use LEFT JOIN on last/first 10 notes view since there could be no voting information
available.
Changed paths:
M manage/user-notes.php
Diff:
diff --git a/manage/user-notes.php b/manage/user-notes.php
index 098d661..5ffbc31 100644
--- a/manage/user-notes.php
+++ b/manage/user-notes.php
@@ -85,13 +85,13 @@ if (!$action) {
if ($type == 1) {
$sql = "SELECT SUM(votes.vote) AS up, (COUNT(votes.vote) - SUM(votes.vote)) AS down,
note.*, UNIX_TIMESTAMP(note.ts) AS ts ".
"FROM note ".
- "JOIN(votes) ON (note.id = votes.note_id) ".
+ "LEFT JOIN(votes) ON (note.id = votes.note_id) ".
"GROUP BY note.id ORDER BY note.id ASC LIMIT $limit, 10";
/* Minor notes */
} else if ($type == 2) {
$sql = "SELECT SUM(votes.vote) AS up, (COUNT(votes.vote) - SUM(votes.vote)) AS down,
note.*, UNIX_TIMESTAMP(note.ts) AS ts ".
"FROM note "..
- "JOIN(votes) ON (note.id = votes.note_id) ".
+ "LEFT JOIN(votes) ON (note.id = votes.note_id) ".
"GROUP BY note.id ORDER BY LENGTH(note.note) ASC LIMIT $limit, 10";
/* Top rated notes */
} else if ($type == 3) {
@@ -111,7 +111,7 @@ if (!$action) {
} else {
$sql = "SELECT SUM(votes.vote) AS up, (COUNT(votes.vote) - SUM(votes.vote)) AS down,
note.*, UNIX_TIMESTAMP(note.ts) AS ts ".
"FROM note ".
- "JOIN(votes) ON (note.id = votes.note_id) ".
+ "LEFT JOIN(votes) ON (note.id = votes.note_id) ".
"GROUP BY note.id ORDER BY note.id DESC LIMIT $limit, 10";
}
}