Results 1 to 10 of 10
  1. #1
    Join Date
    Oct 2007
    Location
    Manila, Philippines
    Posts
    132

    Unanswered: 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;

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    personally I'd do that in the presentation level, but you almost certainly can do that in SQL... have you looked at the manual?

  3. #3
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    i am regularly, and totally, shocked and surprised that people need a database for this type of thing

    today is saturday, dude
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  4. #4
    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

  5. #5
    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;

  6. #6
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    you say "records with the current date"

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

    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  7. #7
    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;

  8. #8
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    records with current date in which field?
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  9. #9
    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;

  10. #10
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    excellent
    Code:
    select ...
      from ...
     where date_added = CURRENT_DATE
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •