somewhat functional notes table (needs improvement)
This commit is contained in:
@@ -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