The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.2.25 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/showthread.php 28 require_once





× This forum is read only. As of July 23, 2019, the UserSpice forums have been closed. To receive support, please join our Discord by clicking here. Thank you!

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Retrieving data from database
#51
I can see that from another filled in column which is called membership.
It either says 10cc or 5cc in there (10cc is 12 months, 5cc is 6 months)
  Reply
#52
Ok.  So it will be something like this.
However you figure out the length, it needs to wind up as a 6 or 12.
$length = 6;  

then
echo date('Y-m-d', strtotime("+".$length." months", strtotime($user->data()->validity)));
  Reply
#53
(01-22-2019, 12:41 PM)mudmin Wrote: Ok.  So it will be something like this.
However you figure out the length, it needs to wind up as a 6 or 12.
$length = 6;  

then
echo date('Y-m-d', strtotime("+".$length." months", strtotime($user->data()->validity)));

like this?

<?php echo date('Y-m-d', strtotime("+".$length=6." months", strtotime($user->data()->validity))); ?><
  Reply
#54
Can you tell me what column stores the length and what the length looks like? Is it a word? is it 6 or 12?
  Reply
#55
(01-22-2019, 01:04 PM)mudmin Wrote: Can you tell me what column stores the length and what the length looks like? Is it a word? is it 6 or 12?

the length is stored in the "membership" column and is either 10cc or 5cc (10 = 12 months / 5 = 6 months).
I could call it 10 or 5 also if that would be better.
  Reply
#56
Nope. That's fine.
if($user->data()->membership == '5cc'){
$length = 6;
}elseif($user->data()->membership =='10cc'){
$length = 6;
}
if(isset($length)){
echo date('Y-m-d', strtotime("+".$length." months", strtotime($user->data()->validity)));
}

I think that will do it.
  Reply
#57
(01-22-2019, 01:11 PM)mudmin Wrote: Nope. That's fine.
if($user->data()->membership == '5cc'){
$length = 6;
}elseif($user->data()->membership =='10cc'){
$length = 6;
}
if(isset($length)){
echo date('Y-m-d', strtotime("+".$length." months", strtotime($user->data()->validity)));
}

I think that will do it.

I'm afraid it doesn't display anything now. I have done it like this now:

<p><strong>Valid until:</strong>
        <?php if($user->data()->membership == '5cc'){
        $length = 6;
        }elseif($user->data()->membership =='10cc'){
        $length = 12;
        }
        if(isset($length)){
        echo date('Y-m-d', strtotime("+".$length." months", strtotime($user->data()->validity)));
        }?></p>
  Reply
#58
(01-22-2019, 01:17 PM)LBC Wrote:
(01-22-2019, 01:11 PM)mudmin Wrote: Nope. That's fine.
if($user->data()->membership == '5cc'){
$length = 6;
}elseif($user->data()->membership =='10cc'){
$length = 6;
}
if(isset($length)){
echo date('Y-m-d', strtotime("+".$length." months", strtotime($user->data()->validity)));
}

I think that will do it.

So this is going to show the length for the logged in user. Does your account have a membership and validity set?
  Reply
#59
(01-22-2019, 01:22 PM)mudmin Wrote:
(01-22-2019, 01:17 PM)LBC Wrote:
(01-22-2019, 01:11 PM)mudmin Wrote: Nope. That's fine.
if($user->data()->membership == '5cc'){
$length = 6;
}elseif($user->data()->membership =='10cc'){
$length = 6;
}
if(isset($length)){
echo date('Y-m-d', strtotime("+".$length." months", strtotime($user->data()->validity)));
}

I think that will do it.

So this is going to show the length for the logged in user. Does your account have a membership and validity set?

yes, bought a 10cc on january 20th 2019

   
I can fill that in on the admin_user form...see attachment
  Reply
#60
Can you paste the chunk of the form itself from the input of time through lessons left? Maybe copy the code and paste on pastebin and share the link here.
  Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)