php - Mysql Variable Calculation -


How would you calculate the difference between 2 variables in MySQL with phyp

for example For example, would be a difficult example (table user , not to make sure where to place it):

  $ vipdays = "UPDATE` vipdays` SUBDIFF ( TO_DAYS (`vipdate)`) -   

vipdate is in SQL date format, and changed from vipdate to days I think that TO_DAYS does this, though it does not After reducing the VPD (after getting the date VIP) and VPID (VIP purchased days), the variable VPDs will be updated in the correct number of days for the user.

This SQL query runs when VPID is checked on the site, but days need to reflect the correct number of days.

Here's an update: I have $ curdate = $ db-> query (" SELECT TO_DAYS ("SELECT TO_DAYS)"

  $ vipdate = $ db- & gt; Query ("Select TO_DAYS (from users") now ()) "$; $ vipday S = $ db-> Query (" Select from user "premium); $ days expired = $ curdate - $ vipdate; $ Balance = $ VPADA - $ days expire; $ Db- & gt; query ("UPDATE` user 'set' premium '=' {$ remainder} ');   

That's what I have done so far ... This would work if sql syntax was correct. Can anyone help?

  $ pdate = str_replace ("/", "-", $ data ['vipdate ']); $ Vipdate = strtotime ($ pdate); $ Cdate = str_replace ("/", "-", Date ("Y-M-D")); $ Curdate = strtotime ($ cdate); $ Vipdays = $ data ['premium']; $ Vipdaysremaining = $ data ['left'];   

Been done and works right Thank you for all your help!

Comments

Popular posts from this blog

python - Writing Greek in matplotlib labels, titles -

c# - LINQ to Entities does not recognize the method 'Int32 IndexOf(System.String, System.StringComparison)' method -

Pygame memory leak with transform.flip -