Jump to content

[SOLVED] displays in php


TGM

Recommended Posts

I have a restaurant database and I want to display the all the orders made by the day.  How can I report all orders made by the day using the date.  On my order table I have a date/time that shows the time n date of the order made...

Link to comment
Share on other sites

how about posting how you tried to implement that solution.

 

$result = mysql_query ("SELECT * FROM orders WHERE date_time(CURDATE(), INTERVAL 1 DAY) <= date ");

 

This one below work but it displays all orders and I want on orders made per day!

 

$result = mysql_query ("SELECT * FROM orders ORDER BY `date_time` ");

 

Link to comment
Share on other sites

Yeah I know.

 

So do you see anything wrong with this:

$result = mysql_query ("SELECT * FROM orders WHERE date_time(CURDATE(), INTERVAL 1 DAY) <= date ");

 

? You did post it a few posts up.

 

THis works but is doing it manually and it only displays 1 order.. Im trying to display all orders made by a day. example display all orders made on '2009-05-10'

 

$result = mysql_query ("SELECT * FROM orders  WHERE `date_time`='2009-05-10 03:36:02' ");  

Link to comment
Share on other sites

Well, here's the breakdown.

 

1. You replaced my DATE_SUB MySQL function with date_time.

2. You should replace date (at the end) with date_time instead.

3. Last, but certainly *NOT* least, Google! :)

 

tnx it works but still doesnt give me what I want..It still displays all the orders from different days.

 

$result = mysql_query ("SELECT * FROM orders  WHERE DATE_SUB(CURDATE(), INTERVAL 1 DAY) <= `date_time` "); 

Link to comment
Share on other sites

Oh oops. My bad. Change that 1 in INTERVAL 1 DAY to 0.

nice works now...jus one last question how would I display all orders made on a month...would changing the Interval be best way to do it.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.