1

dealend を今ではなく昨日に設定したい。このコマンドラインでそれを行う方法はありますか?

$query = mysqli_query($myConnection, "UPDATE bookdeals SET dealend='now()' WHERE id='$pid'") or die (mysqli_error($myConnection));
4

3 に答える 3

5
... SET dealend = now() - INTERVAL 1 DAY

Note that with the 'now()' you're using, you're not using a function called "now". You're trying to set your table field to be a string whose contents are the letters n, o, w etc.... Quotes turn things into strings and those things lose their specialty once they've been stringed.

于 2013-10-16T22:09:31.787 に答える
0

MySQL DATE_SUB 関数を使用できます

... dealend=DATE_SUB(now(),INTERVAL 1 DAY) ...

MySQL 日付関数の詳細については、こちらをお読みください

于 2013-10-16T22:14:01.317 に答える