This topic is locked
[SOLVED]

 automatically record current date & user login

11/9/2015 4:46:13 AM
PHPRunner General questions
O
overmars author

Hi All,
I need your advice...
I just Create a simple application that aims to save the report data.

with table structure like this :
Id_rep INT(5) auto increment

Submit_date DATETIME

Subject VARCHAR(100)

user_name VARCHAR(100)

File VARCHAR(100) <--- attachment
the question are ...

  1. How do I make submit_date field filled with the current date and time automatically every record is added? (not visible to the user)
  2. How do I save a user logged onto the field user_name automatically every record is added?
    The goal is I want to know whether the file report delivered on time (or not) and by whom?
    Thanks,
    I use PHPRunner 8.1
  3. How do I make submit_date field filled with the current date and time automatically every additional data is done?
  4. How do I save a user logged onto the field user_name

romaldus 11/9/2015



Hi All,
I need your advice...
I just Create a simple application that aims to save the report data.

with table structure like this :
Id_rep INT(5) auto increment

Submit_date DATETIME

Subject VARCHAR(100)

user_name VARCHAR(100)

File VARCHAR(100) <--- attachment
the question are ...

  1. How do I make submit_date field filled with the current date and time automatically every record is added? (not visible to the user)
  2. How do I save a user logged onto the field user_name automatically every record is added?
    The goal is I want to know whether the file report delivered on time (or not) and by whom?
    Thanks,
    I use PHPRunner 8.1
  3. How do I make submit_date field filled with the current date and time automatically every additional data is done?
  4. How do I save a user logged onto the field user_name


In before record added/ edit event :

$values["submit_date"]=now();
$values["user_name"]=$_SESSION["UserName"];


The easiest way to set default value of date and time is in your mysql. Set mysql default value to date and time <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=78234&image=1&table=forumreplies' class='bbc_emoticon' alt=':)' />

O
overmars author 11/10/2015



In before record added/ edit event :

$values["submit_date"]=now();
$values["user_name"]=$_SESSION["UserName"];


The easiest way to set default value of date and time is in your mysql. Set mysql default value to date and time <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=78239&image=1&table=forumreplies' class='bbc_emoticon' alt=':)' />


Thanks Romaldus,

Your suggest work well ....