hi hope someone can help me

i have

//get the current date
$dateend = date("Y-m-d");// current date

//datebegin is current date -99 years
$datepast = strtotime(date("Y-m-d", strtotime($dateend)) . " -99 year");
$datebegin = date('Y-m-d', $datepast);

// Connect to server and select databse
mysql_connect("$host", "$username", "$password")or die("cannot connect"); 
mysql_select_db("$db_name")or die("cannot select DB");

$quey1="SELECT * FROM $tbl_name WHERE geboortedatum > $datebegin";
$result=mysql_query($quey1)or die(mysql_error());

This doesn't work can someone help me how to make it work

Member Avatar


echo  $datebegin. " to " . $dateend;


1913-04-22 to 2012-04-22

So it seems your variables are OK.

Try placing the variable in quotes:

$quey1="SELECT * FROM $tbl_name WHERE geboortedatum > '$datebegin'";