PHP. I'm trying to compare two dates. One is dateofbirth stored in a MySQL table and the other is today's date without the year. if the date (m-d) stored in database matches today's date (m-d) a window will pop up.
This is for a Linux server, running MySQL 5, PHP 5.
$sql1 = "SELECT * FROM perfil_aluno WHERE id_usuarios =
'".$_SESSION['usuarioId']."' ";
$query1 = mysqli_query($mysqli, $sql1);
$dados1 = mysqli_fetch_assoc($query1);
$dob = date('m-d', strtotime($dados1['dateofbirth']));
$2day = date('m-d');
if($dob == $2day) {
// execute some code...
}
If the month and day of birth (m-d) stored in the database matches today's date month and day, a window will pop up wishing the user a Happy Birthday.