Re: using the same field to be set in the update query and in the where clause
Date: Sun, 12 Mar 2017 11:17:29 +0100
Message-ID: <oa372f$iu9$1_at_dont-email.me>
On 12.03.2017 06:09, kushal bhattacharya wrote:
> Actually i wanted to know is there any alternete approach apart from this one
An alternate approach to achieve *WHAT* and different from what *OTHER* way?
If you want to update just the timestamp in some row to the current time, do it explicitly:
UPDATE table_name SET timestamp_column=NOW() WHERE ...
putting anything necessary to identify the row behind WHERE.
That same rule applies anywhere: say explicitly what you want the database to do. Don't speculate on side effects.
[Quoted] And since I've seen you using prepared statements all over the place: there is no need to prepare each statement or to use a place holder anywhere in a query where one fits in. Place holders should only be used in positions where the actual value is /variable/. Constants can and should be written directly into the query string. Received on Sun Mar 12 2017 - 11:17:29 CET