I am trying to retrieve the date of birth from users once they submit the form and update the date type, but I am unable to update the date type. Can you tell me what I am doing wrong?
if($_POST){
$dob = date('Y-m-d',strtotime($_POST['year']."-". $_POST['month']."-".$_POST['day']));
$retur = $userObj->updateProfile($dob);
}
public function updateProfile($dob){
$db = db_mysql::getInstance();
$qr = $db->query("UPDATE ".USERS." SET dob = $dob WHERE id = '".$udata."'") or die(mysql_error());
return $udata;
}
Try this:
You should look at using bound parameters, though – it avoids this sort of thing, as well as making your code a lot more secure.
Editted to add:
The manual page on binding parameters has a few very useful examples.