I want to display all contents of a MySQL table. Or may be limit it to the last weeks data.
So I have two questions:
What is the best way to store the date in a table. Is there an ‘auto date’ choice. i realise there is a ‘date’ choice in PHPMyAdmin - I would like to include the time also. I would like to store the time the person adds something to the basket. AND ALSO the time the customer buys. (So if they add stuff to basket Monday and pay on Friday this will show in the MySQL table).
is there is quick way to display a table. I know I could do a MySQL query and echo out the fields. Is there a way in PHP code to write:
Display table customerorders
and how about limiting it to the last weeks, or days information:
Display table customerorders for last 7 days
Display table customerorders for last 1 days
Display table customerorders for last 2 days
Asking the mods to move this to the Database or MySQL forum. PHP does a lot of work there, but there are posters in those forums who are more expert in SQL who don’t frequent this forum as often.
right - ok - but how do I add date and time to a table? I realise if you have text boxes for name, telephone you can add these to a table. But when there is no user-input how can I code it to add date and time to database? If you write something like
Well, first of all, there is a ‘datetime’ field type.
selecting all data from a table would be:
“SELECT * FROM table”;
selecting all data from the last week of the table would be
“SELECT * FROM table WHERE date > CURRENT_DATE - INTERVAL 7 DAY”