產品表:將顯示所有產品 - 列表計數與組由PHP的MySQL
prodid | name | size
1 | prd1 | 30
2 | prd2 | 40
3 | prd3 | 50
4 | prod4 | 20
產品詳細信息: - 當產品清單顯示,我有文本框的每個產品,其中RESP 。用戶填充值(500,300..etc),並提交數據..this數據爲產品的詳細信息保存在下面
id | prdid | userid | value |
1 | 1 | 2 | 500
2 | 2 | 2 | 200
3 | 1 | 3 | 230
4 | 3 | 2 | 300
5 | 1 | 4 | 100
我想要什麼:
Product Count | Product Name | Product Size
3 | prod1 | 30
1 | prod2 | 40
1 | prod3 | 50
| prod4 | 20
下面
是表的列表:
$sql = "SELECT * FROM product ";
$result = $conn->query($sql);
echo "<table border='1'>
<tr>
<th>Product Count</th>
<th>Product Name</th>
<th>Product Size</th>
</tr>";
while($row = mysqli_fetch_array($result)) {
echo "<tr>";
echo "<td>" . ???? . "</td>";
echo "<td>" . $row['name'] . "</td>";
echo "<td>" . $row['size'] . "</td>";
echo "</tr>";
}
echo "</table>";
from above i need 2 things:
1 } product count - count is common
2 } highlight with red/green that count for resp user who's value is higher for that prdid from product details
例如:在產品細節:
prdid 1有3個計數
用戶對prdid 1是3(2,3,4)哪些用戶標識2具有較高的 值是500,因此只對PRODID將 他綠色盛着紅色他的產品列
希望你們明白我的要求....
參見:[?爲什麼要我爲了什麼,在我看來是一個非常簡單的SQL查詢提供MCVE(https://meta.stackoverflow.com/問題/ 333952/why-should-i-provide-an-mcve-for-what-seem-to-what-seems-to-a-very-simple-sql-query) – Strawberry
@Strawberry bro,我的大腦不工作現在..請不要告訴我閱讀那篇文章:(...... btw im非常糟糕的閱讀....請幫助widout閱讀文章 – user3209031
爲什麼減...任何一個告訴我...請關閉任何一個之前提供給我答案 – user3209031