M
|
Mark Kramer 8/3/2019 |
I'm a rank amateur PHP user here ... using latest PHPRunner 10.2 ... All I am trying to do is to simply display Age as calculated from a table's "BirthDate" field using a code snippet inserted into either or both the Add or Edit on design section, nothing complex whatsoever. This very simple code snippet I found is from a very nice 2014 Xlinesoft Blog article: $time1 = new DateTime('1971-03-10'); $time2 = new DateTime('today'); echo $time2->diff($time1)->y; Used as is as a code snippet in my project design section works great as is, resulting in 48 printed out nicely on either page as it should. I have tried repeatedly to replace DateTime('1971-03-10'); with DateTime ($data["BD"]) or some such where BD is the date field from my table in this case the value from the field is: 1952-4-17 but that does not work. What am I missing here? (Probably a lot!). How do I get the value from the BD field into DateTime() correctly for DateTime() to recognize it correctly? Randy J.
|
![]() |
Admin 8/3/2019 |
As a first step make sure you access underlying database data properly. Once you figured that you can perform your calculations. |
U
|
united001 author 8/3/2019 |
Success! Thank you for the hint! I worked out the rest and learned the importance of global variables in the process. Thank you Mark, thank you Sergey! Now on to the next programming dungeon monster. |
H
|
Hd_Mersintarim 8/4/2019 |
SELECT |