Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我已经从数据库中获取了一些值
$sql = "select today earning form sql where username =$username date= today"
作为回报的数据将是动态的,因为我不知道它将产生多少行
我想向用户显示一张记录表,如下所示
日期:今天赚100
日期:今天赚200
日期:今天收入 11
日期:今天收入 1
今日总收入 312
所以实际的问题是,因为我不知道会有多少行,所以如何计算今天收益的总值?
试试这个
SELECT SUM(today tearning) FROM `sql` WHERE username =$username date= now();
SELECT SUM(today_earning) FROM sql WHERE username='username' date= now()