title: run script after due date
body: <p>I have created a script to run after the due date is over once due date is over the query will update the status and expire the subscription but as of now I am getting a malfunction issue and the issue is that weh I run script it updates the status to expired I do not know as it should not run query</p>
  
  <p>Here is my code</p>
  
  <pre><code>&lt;?php
      if($user_data['subscription'] == 'Activated'):
          $sql_chk    = $this-&gt;db-&gt;get_where('payment_trans', array('user_id' =&gt; $user_data['id']));
          $date_payed = $sql_chk-&gt;row()-&gt;date_payed;
          $d_get      = new DateTime($date_payed);
          $d_get-&gt;modify('+1 year');
          $new_year   = $d_get-&gt;format('m-d-Y');
          $crnt_year  = time();
  
          if($crnt_year &gt; strtotime($new_year)) {
              $data = array(
                  'subscription' =&gt; 'Expired'
              );
  
              $this-&gt;db-&gt;where('id', $user_data['id']);
              $this-&gt;db-&gt;update('users', $data);
          }
      endif;
  ?&gt;
  </code></pre>