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 for diafol

OK

echo  $datebegin. " to " . $dateend;

Gives:

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'";
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.