Showing
2 changed files
with
2 additions
and
2 deletions
... | @@ -10,7 +10,7 @@ router.get('/:lecture_id', function(req, res, next) { | ... | @@ -10,7 +10,7 @@ router.get('/:lecture_id', function(req, res, next) { |
10 | var lecture_id = req.params.lecture_id; | 10 | var lecture_id = req.params.lecture_id; |
11 | 11 | ||
12 | pool.getConnection(function(err, conn){ | 12 | pool.getConnection(function(err, conn){ |
13 | - conn.query('select * from lecture;', function (err, rows){ | 13 | + conn.query('select * from lecture where lecture_id = ?;', [lecture_id], function (err, rows){ |
14 | if (err) return res.status(500).json({error: err}); | 14 | if (err) return res.status(500).json({error: err}); |
15 | if (!rows) return res.status(400).json({error: 'not found'}); | 15 | if (!rows) return res.status(400).json({error: 'not found'}); |
16 | var msg = { | 16 | var msg = { | ... | ... |
... | @@ -10,7 +10,7 @@ router.get('/:lecture_id', function(req, res, next) { | ... | @@ -10,7 +10,7 @@ router.get('/:lecture_id', function(req, res, next) { |
10 | var lecture_id = req.params.lecture_id; | 10 | var lecture_id = req.params.lecture_id; |
11 | 11 | ||
12 | pool.getConnection(function(err, conn){ | 12 | pool.getConnection(function(err, conn){ |
13 | - conn.query('select s.student_id AS student_id, s.student_name AS student_name from lecture_students l JOIN student s USING (student_id);', function (err, rows){ | 13 | + conn.query('select s.student_id AS student_id, s.student_name AS student_name from lecture_students l JOIN student s USING (student_id) where l.lecture_id=?;', [lecture_id], function (err, rows){ |
14 | if (err) return res.status(500).json({error: err}); | 14 | if (err) return res.status(500).json({error: err}); |
15 | if (!rows) return res.status(400).json({error: 'not found'}); | 15 | if (!rows) return res.status(400).json({error: 'not found'}); |
16 | var msg = { | 16 | var msg = { | ... | ... |
-
Please register or login to post a comment