Forums

How to display the user's age with PHP?

Aluizojr 12 Apr, 2011
Hi there ppl! I tried, but came with two simple questions... Any help would be great ;D

First things first:
I'm trying to display the age of a person in DB, but there's no column (so the result is only in the View) and got no clue how to do it.. I can show data from the pre-defined columns, but not caulculating queries. Please someone tells me?


Second:
A minor one... I check the "try to republish" values after an error (it's for the CF), but it only republished the *required fields*, not the non-required... This is more rememberance for the user who is registering in the BD in that section...



Thanks for even reading this! Hope it serves for ppl in the same situation.

😀
GreyHead 13 Apr, 2011
Hi Aluizojr,

What information do you have to calculate the age from?

I've never seen that problem with Republish before :-( Please post a link to the form so we can take a quick look.

Bob
Aluizojr 13 Apr, 2011
Oh hi there Bob! 🙂

I have a birthday field which is Date type (Y/M/D).
Ok, in my database there's no specific column to record a user's age (because it updates every year for each user), I just have the birthday column.
So, what I need is to display that person's age along with other data, using a PHP function or something like that... so what would be in the "body" text area of CC:


<div>
Name: {name}
Age: {age} <!-- could be like that or pure PHP expression -->
Phone Number: {phone_number}
.
.
.
</div>


- please note that I'm using divs to display boxes with each user's data, also there's more variables and in portuguese. But as we know, they just need the "{}" to display... 🙄

////////////////
About the other problem (republish) it seems that's a bug with my Joomla! instalation, so I'll solve this later Sir. I'd checked the source but similar required field types have different behaviors once republished...😑

But thanks again Bob!
This topic is locked and no more replies can be posted.