I have a form where I collect a bunch of basic information (name, email, etc), I then post that to a database. On that form, I use the php date function to insert a “day”, “month”, and “year” database column so it will show me what date the form data was submitted.
I want to output this to a table (so I can check it without logging into the db), and I want that table to default to the current date. I thought something like this would work, but it doesn’t:
$query="SELECT * FROM form_data WHERE day='echo date("d");' AND month='echo date("m");' AND year='echo date("Y");'";
Ultimately, I want to have some date select boxes where the table is displayed, so I can select any date I want, submit, and return the relevant data to the table. But the first step is just getting the table to default to display today’s current data.
Much appreciated if anybody can help.
You can’t do echo date(“d”); in an sql statement or you would be effectively putting a statement inside a statement.
You must save your echo date(“d”); into a variable and then do something like
or use separating . to shoot them in like