somewhat functional notes table (needs improvement)
This commit is contained in:
1 parent
8c13989d47
commit
b6d51cbc37
3 files changed
+69
-19
No files matched your search
@@ -5,15 +5,12 @@ use ppa\Model\ParticipantModel;
|
||||
|
||||
class NotesModel extends Database
|
||||
{
|
||||
public function selectNotes()
|
||||
public function selectNotesForUser($userid, $sortBy = 'updated_at', $sortOrder = 'DESC')
|
||||
{
|
||||
$sortBy = 'updated_at';
|
||||
$sortOrder = 'DESC';
|
||||
|
||||
$sql = "SELECT id, title, content, created_at, updated_at
|
||||
FROM notes
|
||||
WHERE user_id = 2
|
||||
ORDER BY updated_at DESC";
|
||||
$sql = "SELECT n.*, u.username AS owner_username
|
||||
FROM notes n
|
||||
JOIN users u ON n.user_id = u.id
|
||||
ORDER BY {$sortBy} {$sortOrder}";
|
||||
|
||||
$pdo = $this->linkDB();
|
||||
|
||||
|
||||
Reference in new issue
Block a user