php - Updating database with certain date -
for internship i'm done program though need make can update database. problem here can not update using date selected user due timestamp in database. there way can either add time behind variable or make can have update query ignore time part?
here current code program's update query.
if(isset($_post['pasaan'])) { $voor = $_post['voor0900']; $na = $_post['na0900']; $datum = $_post['datum']; $datum = datetime::createfromformat("d/m/y" , $datum); $datum->format('y-m-d'); $datum $sql = "update `firsthousing` set `voor0900` = '$voor', `na0900` = '$na' datum = '$datum'"; if ($db->query($sql) === true) { echo "new record created successfully"; } else { echo "error: " . $sql . "<br>" . $db->error; } }
with kind regards, daynie
you can use date()
return date part
$sql = "update `firsthousing` set `voor0900` = '$voor', `na0900` = '$na' date(datum) = '$datum'";
Comments
Post a Comment