[英]How to add values in mySQL together with PHP
I need to add values in MySQL
and see if its greater than another value then echo
the amount of rows. 我需要在
MySQL
添加值,看看它是否大于另一个值,然后echo
显行数。
$result = mysql_query("SELECT created_at,seconds FROM table WHERE created_at + seconds > CURTIME()");
$num_rows = mysql_num_rows($result);
echo $num_rows;
If seconds
is an integer column, use DATE_ADD
: 如果
seconds
是整数列,请使用DATE_ADD
:
SELECT created_at, seconds FROM table
WHERE DATE_ADD(created_at, INTERVAL seconds SECOND) > CURTIME()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.