This topic is locked
[SOLVED]

 Auto input date joined

1/11/2017 4:53:57 PM
PHPRunner General questions
Tandy author

I am having a hard time with the joined field. I have the account table made up and one of the fields is Joined which is to be auto filled in. I also have LastedEdited that works great.

For the Joined I put in the add to Events - Add page - Before record added
$values["Joined"]=now();

return true;
The one that works I added to events - Edit page - Before record updated
$values["LastEdited"]=now();

return true;
So why would the Joined field not be working?

I can go into the database on my server and add

Field: Joined

Type: TIMESTAMP

Default: CURRENT_TIMESTAMP

That works fine until I try to put it back into PHPRunner. Then I get an error?
Thank for any help I might get on this.

Oh and I took it from the forum template but noticed it does not work there either now.

lefty 1/12/2017



I am having a hard time with the joined field. I have the account table made up and one of the fields is Joined which is to be auto filled in. I also have LastedEdited that works great.

For the Joined I put in the add to Events - Add page - Before record added
$values["Joined"]=now();

return true;
The one that works I added to events - Edit page - Before record updated
$values["LastEdited"]=now();

return true;
So why would the Joined field not be working?

I can go into the database on my server and add

Field: Joined

Type: TIMESTAMP

Default: CURRENT_TIMESTAMP

That works fine until I try to put it back into PHPRunner. Then I get an error?
Thank for any help I might get on this.

Oh and I took it from the forum template but noticed it does not work there either now.



In Phprunner form / field editor settings:

for Joined field with date make the field readonly with default set to now("%m/%d/%y") since it's at record save time ( no need to autofill ) . And take out add event. And in the edit field make Lastedited readonly and add to autoupdate readonly and add default value now("%m/%d/%y") and take out event for edit . No need for events , If I am reading you right. View as short date or long if needed and make adjustments to ("%m/%d/%y"). If it is auto filled with Now() it's going to be today so why autofill date field. These fields need to be in database with date field type set for mysql or access . Type is Date or Date / Time field. Not Timestamp ( Set default in database to null ) as it should not be needed according to the information above. If not we need more info as why it should be set to timestamp

Tandy author 1/12/2017

Thank You John, I just tried that way and it still does not put the joined date in.
Here is what I am trying to do. When someone joins the site. The date they joined gets auto put in the database. Here is what I have so far:

I have a table called account

In that table I have

Account ID

Joined

LastedEdited
Joined and LastEdited are DateTime in the database. As I said in the other post. LastedEdited is working great. The only way I get the Joined date in is thought the database in default putting in CURRENT_TIMESTAMP.

I know that is not right because in PHPRunner I get the error.

admin 1/12/2017

Make sure that Joined field's data type is in fact DateTime and not Timestamp as were specified in first post. Also make sure that field name is correct as 'Joined' and 'joined' are two different field names.

Tandy author 1/12/2017



Make sure that Joined field's data type is in fact DateTime and not Timestamp as were specified in first post. Also make sure that field name is correct as 'Joined' and 'joined' are two different field names.


It is DateTime. And I even copied it to the events. Like I said the LastedEdited works great. It is just the Joined that does not work. Every way I tried it.

lefty 1/13/2017



It is DateTime. And I even copied it to the events. Like I said the LastedEdited works great. It is just the Joined that does not work. Every way I tried it.


before doing below you stated that you copied to events. Do not use events in this situation . There is no need. You also mentioned that when someone joins . How are they joining . I suppose a form ( makes sense - then all you need is what I mentioned above for further instructions see below.
Okay , first of all what version of phprunner you use . You should always mention that and the build.
Try this : delete the joined field in the database from phprunner program in the tables area (right click modify database table ) and not in the database admin Then sync database . Okay now there is no joined field.

2. Click on table right click and add field called joined in this exact case lowercase . field is called joined type is date/time . Do not go into the database structure and change anything.

3. Click okay and sync database again.

4. Go to query page in phprunner and check the box joined to make sure it is now back in query.

5. Go to your fields page section in phprunner and add joined to list, edit , add page and so on where you want it to show up. ex print.

6. Click on the properties of the field either in that page or in visual editor and see directions with my post above .

7. Go to totals page and insert your joined field where you want it to show on each page add,edit,view ,print and so on.

8. If that does not work then you need to post some screenshots of what I showed you above or contact support directly as it should work . No need to put anything in events for this , If you use events in this situation, that may be causing the issue.

8. Do this for both fields even though LastEdited field works in event. This way we know it is not causing the issue.

9. Just to make sure , what is your key field in this table ? is it Account ID and is it set to autonumber from phprunner and in your database.

Lastly do not autofill these fields as the way you describe with NOW() means at record save , so no need for any connection to other fields in your table.Autofill is for grabbing data from other tables and autofilling values based on fields in other table . This is not needed nor is joined or LastEdited depended on any other fields as you are looking for todays date in the ADD page and when edited today's date on the edit page .

Tandy author 1/13/2017

I did like you said. I have attached some screen shots.

First I removed the Joined and LastEdited.

I then sync the database and made sure they were gone.

I then added them back to the database. All in lowercase. Yes my Key Field is Account_ID with Type int, Size 11, Not NUll checked, Primary key checked, and Auto-increment field set to Account_ID.


Then here is my List of tables:


I went to the fields page and clicked on Properties and made them both joined and lastedited are set to ReadOnly.



I does not mater where I put them as I am just testing to try and get it to work. But it does not input the date?


The edit date does work this way but the joined date does not.
Oh and I am using PHPRunner Enterprise 9.6 (Build 27826 x64)
Thank you for your help..

admin 1/13/2017

If you have a valid support contract I suggest posting your project to Demo Account and contacting support directly. Without seeing your project and database we can only guess while this should be something relatively simple.

romaldus 1/13/2017
Tandy author 1/13/2017





Sorry That did not work either.

I will just close this and take out the Joined Date all together.
Thanks all for trying to help..

James

lefty 1/13/2017



Sorry That did not work either.

I will just close this and take out the Joined Date all together.
Thanks all for trying to help..

James



Just wanted to see view as screen where joined field is setup . That will tell the tale.

romaldus 1/13/2017

I've never experienced anything like this in phprunner since 2008.

Server environment such as PHP Mysql version and configuration usually causes errors.

Tandy author 1/14/2017

Thanks guys for trying to help. I am just redoing the whole project and keeping joined date out. It does not seem that maybe it is my server will not put the date in on someone joining the site. It did put it in after registered and they updated there account information but not when joining. It is not that big of a deal. The project is mainly for me keeping track of my trip sheets being a trucker.
Thanks again for trying.. Be safe

James