If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > day today query?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-15-08, 03:47
homer.favenir homer.favenir is offline
Registered User
 
Join Date: Oct 2007
Location: Manila, Philippines
Posts: 132
day today query?

hi,
what is the syntax for getting the day today?
like monday, tues....

thanks
__________________
Take Nothing But Pictures;
Leave Nothing But Footprints;
Kill Nothing But Time;
Reply With Quote
  #2 (permalink)  
Old 03-15-08, 05:39
healdem healdem is online now
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,262
personally I'd do that in the presentation level, but you almost certainly can do that in SQL... have you looked at the manual?
Reply With Quote
  #3 (permalink)  
Old 03-15-08, 08:49
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
i am regularly, and totally, shocked and surprised that people need a database for this type of thing

today is saturday, dude
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #4 (permalink)  
Old 03-15-08, 15:25
websitehacks websitehacks is offline
Registered User
 
Join Date: Mar 2008
Posts: 11
I think the OP is trying to insert the day into the database. If that isn't what you want, try being a bit more clear. Otherwise, to insert the day that the script was executed by the user, try this:

1-Define today
Code:
$today = date("l");

2-Insert this into the db
Code:
//your db connection goes here

$query=mysql_query("INSERT into TABLE (theday) values ('$today')");
__________________
Website Hacks
Programming/computer help
Reply With Quote
  #5 (permalink)  
Old 03-19-08, 15:10
homer.favenir homer.favenir is offline
Registered User
 
Join Date: Oct 2007
Location: Manila, Philippines
Posts: 132
thanks guys.
i just want to get the records with the current date. no more selections or searchings...

__________________
Take Nothing But Pictures;
Leave Nothing But Footprints;
Kill Nothing But Time;
Reply With Quote
  #6 (permalink)  
Old 03-19-08, 15:14
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
you say "records with the current date"

and i say "which column, what datatype, and how do the values get inserted?"

__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #7 (permalink)  
Old 03-19-08, 15:58
homer.favenir homer.favenir is offline
Registered User
 
Join Date: Oct 2007
Location: Manila, Philippines
Posts: 132
it is just a query that will return records with current date.
__________________
Take Nothing But Pictures;
Leave Nothing But Footprints;
Kill Nothing But Time;
Reply With Quote
  #8 (permalink)  
Old 03-19-08, 17:04
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
records with current date in which field?
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #9 (permalink)  
Old 03-19-08, 19:18
homer.favenir homer.favenir is offline
Registered User
 
Join Date: Oct 2007
Location: Manila, Philippines
Posts: 132
date field with datetime datatype...
__________________
Take Nothing But Pictures;
Leave Nothing But Footprints;
Kill Nothing But Time;
Reply With Quote
  #10 (permalink)  
Old 03-19-08, 19:46
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
excellent
Code:
select ...
  from ...
 where date_added = CURRENT_DATE
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On