This topic is locked
[SOLVED]

 Future date as default value

5/27/2017 12:36:40 AM
PHPRunner General questions
romaldus author

I have a date field in MySQL database (field type: date).

In phprunner "add page before record added" event i use the following code to calculate date (7 days from now):



$values['next_schedule']=date('Y-m-d', strtotime('+7 days'));


The code results empty string in database. What's wrong?

C
cristi 5/27/2017

If you define the field type as "date" in mysql then phprunner edit the field as "date". Change the field "edit as" type from "date" to "text field" in the visual editor and your code will work.

romaldus author 5/27/2017

Thanks cristi but "next_schedule" field was not selected in phprunner "choose field".

https://www.xlinesoft.com/phprunner/docs/choose_fields.htm

I want "next_schedule" field value is set using event.

C
cristi 5/27/2017

Then define 'next_schedule' as "varchar" in your database and not "date" and it still works...tested by me.

admin 5/27/2017

Print value of $values['next_schedule'] on the page after it were set to make sure value is correct.

romaldus author 5/28/2017

solved thanks