Run the entered date through this little code test and it will format it then just use the $regs[] values in your query.
$date ="31.01.2006";
if (ereg ("([0-9]{1,2}).([0-9]{1,2}).([0-9]{4})", $date, $regs)) {
echo "$regs[3]-$regs[2]-$regs[1]";
} else {
echo "Invalid date format: $date";
}
Try it with different dates from wherever you get your input, you can use the ereg above to manipulate the date how you want it, but MySQL will accept a date as follows 2006 01 23 2006/01/23 2006.01.23 or 2006-01-23