Loading ...
Sorry, an error occurred while loading the content.

Re: [phpXperts] Updating Date

Expand Messages
  • Mety Soriano
    How to update the age sir.. Do I directly insert the below command without any WHERE condition? SELECT Datediff(Now(), `birthdate`) AS `age`
    Message 1 of 3 , Feb 24, 2013
    • 0 Attachment
      How to update the age sir..

      Do I directly insert the below command without any WHERE condition?

      SELECT Datediff(Now(), `birthdate`) AS `age`
      FROM   `snhf_fattener`;

      $update = "UPDATE snhf_fattener set age = '$age'";
       
       Is this correct?


      MATIAS 'Mety' SORIANO
      MIS/IT Director/Consultant/Professor
      Contacts: Tel: (042)3736167 Cel: 09282860545
       


      From: shiplu <shiplu.net@...>
      To: phpexperts <phpexperts@yahoogroups.com>
      Sent: Sunday, 24 February 2013, 3:45
      Subject: Re: [phpXperts] Updating Date

       

      You should not save `age` in database. `age` should be a derived attribute, means it'll be calculated upon request. Store only the birth date.

      To retrieve date use DateDiff function in mysql.

      SELECT Datediff(Now(), `birthdate`) AS `age`
      FROM   `snhf_fattener`; 



      --
      Shiplu.Mokadd.im
      ImgSign.com | A dynamic signature machine

      Innovation distinguishes between follower and leader


    Your message has been successfully submitted and would be delivered to recipients shortly.