I have my code:
$db_date2;
$today2 = date("Y-m-d");
$sql1 = "SELECT * FROM todays_spend WHERE id =$user_id_session AND date=$today2";
$date_records = mysql_query($sql1);
while($today_trip=mysql_fetch_assoc($date_records)){
$db_date2 = $today_trip['date'];
}
echo $db_date2;
It is saying "Undefined variable: db_date2". When I remove the AND statement it works. Am I doing the AND statement wrong? the 'date' field in my database is also saved in the format Y-m-d.
also tried the single qoutes '' around the variables, still not working!