YujeLee

Backend: sortbydate.js 개발(검색엔진)

1 +var mysql = require('mysql');
2 +var near_show_list = [];
3 +var connection = mysql.createConnection({
4 + "host": "culturegallery.cm2bwcuyukrm.us-east-1.rds.amazonaws.com",
5 + "user": "root",
6 + "password": "dldbwp1207",
7 + "port": "3306",
8 + "database": "showdata"
9 +});
10 +
11 +connection.connect();
12 +
13 +// 데이터 길이 파악 //
14 +var dataNum=0;
15 +connection.query('SELECT COUNT (*) AS cnt FROM SHOW_DATA', function (error, results, field) {
16 + if (error) {
17 + console.log(error);
18 + }
19 + dataNum = results[0].cnt;
20 + console.log(dataNum);
21 +});
22 +
23 +connection.query('SELECT start_day FROM SHOW_DATA WHERE start ORDER BY start_day',function(error,results,field){
24 + if(error){
25 + console.log(error);
26 + }
27 + console.log(results);
28 +})
29 +
30 +connection.end();
...\ No newline at end of file ...\ No newline at end of file