您好我正在尝试从管理员处获取未读回复的数量。那些是支持票。有三个表如下。
table: supportticket
id | date | username | email | status | subject | message | adminreply |
admindate | read
table: ticketreplies
id | tid | userid | name | email | date_added | message | admins
table: tickets
id | userid | trackid | name | email | date_added | title | message |
status | urgency | lastreply
table: ticket_read
id | idt | lu
我试过了:
$query = "SELECT COUNT(*) FROM first table WHERE to_user_id
=".$_SESSION['user_id']." AND `read` = 0";
但没有成功。希望有更多的想法。我是新人。
*when ticket is created by user this table gets update:
tickets
id | userid | trackid | name | email | date_added
| title | message | status | urgency | lastreply
456 2 123-456 user user@user.com 3/23/2017
15:52 test test open medium
3/24/2017 15:52
* when admin replies
ticketreplies:
id | tid | userid | name | email | date_added
| message | admins 0 456 0
3/23/2017 15:52 replied to test 1
ticket_read
id | idt | lu
0 456 1
P.S。当管理员回复票证表获取状态已回答并且最后获得新的日期时间
检查图片:prntscr.com/eo0pj2
答案 0 :(得分:0)
我确信它不是to_user_id
而id
first_table
所以这样改变
$query = "SELECT COUNT(*) FROM `first_table` WHERE `id`
='".$_SESSION['user_id']."' AND `read` = 0";
假设您没有提供确切的表格名称,为什么first table
不是first_name
答案 1 :(得分:0)
试试这个
$query = "SELECT COUNT(*) FROM first table
WHERE first_table.id =".$_SESSION['user_id']." AND `read` = 0";
答案 2 :(得分:0)
由于没有太大的信息是在问题(表之间没有逻辑连接在问题提供)给定的,则在壳体id
是票的参考号码可以尝试这一点。
$query = "SELECT COUNT(*) FROM supportticket
INNER JOIN tickets
ON supportticket.id=tickets.id
WHERE tickets.userid =".$_SESSION['user_id']." AND supportticket.read = 0";
或者
$query = "SELECT COUNT(*) FROM supportticket
INNER JOIN ticketreplies
ON supportticket.id=ticketreplies.id
WHERE ticketreplies.userid =".$_SESSION['user_id']." AND supportticket.read = 0";
答案 3 :(得分:0)
根据我对您的问题和表格结构的理解,您应该使用$this->field['class']
。并对表格进行一些更改。
示例:
function asyncTask1(done) {
setTimeout(() => {
console.log('task 1 done');
done(1);
}, 500);
}
function asyncTask2(done) {
setTimeout(() => {
console.log('task 2 done');
done(2);
}, 400);
}
function asyncTask3(done) {
setTimeout(() => {
console.log('task 3 done');
done(3);
}, 300);
}
function sequential(tasks = []) {
}
sequential(tasks);
first_table应该包含 trackid ,就像你的second_table一样。此票证ID将是您获取特定用户的所有未读回复的关键。
但这将根据您存储邮件的方式和回复表格而改变。