C
C
cheketes2018-05-09 21:13:19
Database design
cheketes, 2018-05-09 21:13:19

Automatic daily database change?

There is a user's daily income in the database. How can I make it automatically calculated?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Sergey Sokolov, 2018-05-09
@sergiks

A couple of options:
a) run a script by cron that will update the records;
b) store only the user's registration date. His income at any point in time is calculated from the number of days since registration.

P
Push Pull, 2014-06-07
@deadbyelpy

language="JavaScript" is the wrong approach, there is not even such an attribute. it is more correct to write
type="text/javascript"
and also with onclick, hang the handler via js

function multiply(){
      document.getElementsByClassName('window')[0].innerhtml = '';    
      var a=document.forma1.t1.value*2;
    
      alert("Ширина окна слишком велика"); 
      var s=(a-5)/19;
      var b=a+30;
      if((a+30)>580)
        {
        alert("Ширина окна слишком велика"); 
        return(0);
        }
      
      s = Math.ceil(s); 
      document.getElementsByClassName('window')[0].style.width = s*19; 
      var i=0;
      for(i=0;i<s;i++)
        {
        var newdiv = document.createElement('div');
        newdiv.className = 'lamel' ;
        document.getElementsByClassName('window')[0].appendChild(newdiv);
        }
      document.forma1.res.value=s; 
    }    

document.addEventListener('readystatechange', function(){
    var btn = document.getElementsByName('button');
    btn.addEventListener('click', multiply);
    });

P
Pavel K, 2014-06-07
@PavelK

getElementsByClassName

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question