Hello

Is there a easer way to make my PHP code to MYSQL request, instead of using the PHP code first the inserting the request in to mysql sow I can list out my right values.

<?
$day = date("w");
$day = $day == 0
? -6
: 1-$day;

$vecklypoll = date("Y-m-d", strtotime("$day days")); 

$result = mysql_query("SELECT srvplon FROM srv_poll WHERE srvplde = '$vecklypoll'") or die (mysql_error());
$vecklyoption = mysql_fetch_array($result);
?>

    MySQL supports numerous DATE TIME functions to format dates and times...RTFM

      Originally posted by bastien
      MySQL supports numerous DATE TIME functions to format dates and times...RTFM

      I have looked in it i have the problem of how to solve or to get the right date of the last curret date of monday and i dont know how to get it.

      i do not know of on the right path here is what i have done so far...

      $t = mysql_query("SELECT srvplon FROM srv_poll WHERE IF(DATE_FORMAT(NOW(), '%w') = 1, srvplde = ADDDATE(????, INTERVAL -1 DAY), srvplde = ADDDATE(???, INTERVAL -6 DAY))") or die (mysql_error());
      $n = mysql_fetch_array($t); 
      

        Originally posted by Chrysanthus
        get the right date of the last curret date of monday

        um, huh? I don't get what date you are after? last monday of the month, coming monday, last monday? Can you clarify?

          Oki the date of the last monday from today or someother day this week, can't find any thing in the MYSQL manuel that refears to a function in mysql that points out the date of last monday or someother date this week if there is then i must be blind or something.

          it's for adding or removeing days from the last current date of monday sow i can list the right values.

            what is the goal of the querry?

              To add or to remove days from last monday date if its not monday today i think that's the way i did it in PHP.

              like this exampel

              if it's not monday to day liste after last mondays date from to day

              exampel

              today is it 2005-03-03 and its not monday to day
              the MYSQL shal liste efter last mondays date and that is int this exampel 2005-02-28

              Othervise if it is monday to day the MYSQL will list after todays date.

              the only thing that i dont solved yest is what to put in the fieald ???

              $t = mysql_query("SELECT srvplon FROM srv_poll WHERE IF(DATE_FORMAT(NOW(), '%w') = 1, srvplde = CURDATE(), srvplde = ???)") or die (mysql_error());
              $n = mysql_fetch_array($t); 
              
                Write a Reply...