varsqlquery='SELECT name, thum_link, webtoon_link, week, last FROM user u, user_toon_relation ur, toon t WHERE u.id=? && u.id=ur.user_id && t.toon_index=ur.toon_index;';
varmylist;
varsqlquery='SELECT name, thum_link, webtoon_link, week, last, latest FROM user u, user_toon_relation ur, toon t WHERE u.id=? && u.id=ur.user_id && t.toon_index=ur.toon_index;';
connection.query("SELECT COUNT(*) FROM user_toon_relation WHERE user_id=? && toon_index=?",
[id,index],function(err,rows,result){
if(err){
console.log("내웹툰 등록중 에러!");
}else{
varcount=rows[0]["COUNT(*)"];
if(count>0){//이미 등록되어 있는 것이라면,
connection.query("DELETE FROM user_toon_relation WHERE user_id=? && toon_index=?;",
[id,index],function(err,rows,result){
if(err){
console.log("내 웹툰 제거중 에러!");
throwerr;
}else{
//alert("제거되었습니다.")
res.redirect('/setting');
}
});
}else{
addMyToons(id,index,function(){
res.redirect('/setting');
});
}
}
});
});
functiongetMyToons(id,cb){
varsqlquery='SELECT name, thum_link, webtoon_link, week, last FROM user u, user_toon_relation ur, toon t WHERE u.id=? && u.id=ur.user_id && t.toon_index=ur.toon_index;';