mysql日期添加或日期子变量?

Is it possible to use mysql date add or sub with a variable if I set it.

UPDATE table SET time = DATE_ADD(NOW(), INTERVAL $minutes MINUTES);

I have tried but can't get it working?

Thanks

TRY

$qry = "UPDATE table SET time = DATE_ADD(NOW(), INTERVAL ".$minutes." MINUTE) ";

Assuming you're using PHP to get the expression part of DATE_ADD done right, you're using MINUTES rather than MINUTE, which is the unit you're looking for:

UPDATE table SET time = DATE_ADD(NOW(), INTERVAL $minutes MINUTE);

Also see the MySQL documentation

Coming in late to advocate protection from SQL Injection.

$qry = 'UPDATE table SET time = DATE_ADD(NOW(), INTERVAL ' . (int)$minutes . ' MINUTE)';

Note: Credit to diEcho and fivedigit for their foundational answers.