I would like to look up the database table for people whose registered date equals 4-22.
My sql would look something similar like this
function GetUsers($dreg)
{
$dt=(new DateTime($dreg))->format('Y-m-d');
$result=$this->query("SELECT * FROM tablex WHERE dreg='$dt'");
return ($this->getNumRows()>0)?$result:null;
}
However the sql turns out incorrect because I need to get only month and day when the employee registered not the year.
You have to compare just day and month instead of the whole date: