您好,我正在嘗試從管理員處獲取未讀回覆的數量。那些是支持票。有三個表如下。用COUNT函數計算新答覆
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 [email protected] 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.當管理員回覆門票表得到的地位回答lastreply得到新的日期時間
支票影像:prntscr.com/eo0pj2
你如何在不同的表中存儲消息和回覆? –
請提供表名。 –
請以明確的方式說明事情。例如,你的意思是「但沒有成功」? (發佈實際的錯誤或獲得的結果)... – etsa