0

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

Edited by johnnyd1963

2
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by johnnyd1963
0

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'";

Edited by diafol

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.