I've been working on a method that will fetch all dates that contain "2014" and replace that value with "2016" without changing the rest of the date. I have already been able to return all the columns that contain "2014" but I do not know how to only change this value in all strings. Thanks for any suggestions.
The code I ran was as follows:
<?php
$query = "SELECT * ";
$query .= "FROM voo ";
$result = mysqli_query($connection, $query);
if(!$result) {
die ("Database query failed.");
}
//while($row = mysqli_fetch_row($result)){
// if (strpos($result,'2014') !== false) {
$query = "UPDATE voo SET DataPartida = DATE_ADD(DataPartida, ";
$query .= "INTERVAL 2 YEAR) WHERE year(DataPartida) = '2014'";
var_dump($row);
//}
echo "<hr />";
//}
?>
Example: "2014-01-02 18:00:00" You want to stay "2016-01-02 18:00:00"