Having problems with a query on a date variable. Enter query selecting rows between dates. When I do the query with the actual dates typed in - the query runs fine. But when I do the query with the variables I get everything. The variables come from a http form with the month, day, and year coming by way of a drop down list. Here is the code in question. thanks for any help.
$begin_date=$begin_year."-".$begin_month."-".$begin_day;
$end_date=$end_year."-".$end_month."-".$end_day;
$result=mysql_db_query($DBName, "SELECT term_id, d_cl_date, d_nbr_tran, d_cash_dis, d_surchg, d_settle, d_atm_adj, d_bnk_adj, d_fund_dep, d_atm_bal, d_fund_ord, d_bnk_bal, d_int_amt from dailybal WHERE (term_id='$term1') AND ((d_cl_date >= '$start_date') AND (d_cl_date <= '$end_date'))");
while($row2=mysql_fetch_object($result)){
$date_tran = SUBSTR($row2->d_cl_date,4);
$begin_date=$begin_year."-".$begin_month."-".$begin_day;
$end_date=$end_year."-".$end_month."-".$end_day;
$result=mysql_db_query($DBName, "SELECT term_id, d_cl_date, d_nbr_tran, d_cash_dis, d_surchg, d_settle, d_atm_adj, d_bnk_adj, d_fund_dep, d_atm_bal, d_fund_ord, d_bnk_bal, d_int_amt from dailybal WHERE (term_id='$term1') AND ((d_cl_date >= '$start_date') AND (d_cl_date <= '$end_date'))");
while($row2=mysql_fetch_object($result)){
$date_tran = SUBSTR($row2->d_cl_date,4);