Sending date query to database

$date = getdate(); $query = "UPDATE Members Set Name = '$desiredName', Latest_Update = '$date' Where ID = '$currentID'"; if(sqlsrv_query($conn, $query)) { echo "Record successfully updated."; }

I have this query to update a name of a member and whenever I update the name I want to also update the time of the update. Currently this query does not work with the Latest_Update query but everything else works if I remove that. My question is how do I update a datetimeoffset using this query? As at the moment, it does not send the query.

-------------Problems Reply------------

Rather than create the datetime in php, use the built in function SYSDATETIMEOFFSET()

$query = "UPDATE Members Set Name = '$desiredName', Latest_Update = SYSDATETIMEOFFSET() Where ID = '$currentID'";

Category:php Views:3 Time:2018-04-12
Tags: php mysql date

Related post

Copyright (C) dskims.com, All Rights Reserved.

processed in 0.089 (s). 11 q(s)