Probably basic stuff, but although I'm familiar with querying MySQL using , for example:
$result = mysql_query("SELECT * FROM mytable WHERE ID='$ID'",$db);
while ($myrow = mysql_fetch_array($result)) {
$ID=$myrow[0];
$Forename=$myrow[1];
$Surname=$myrow[2];
etc.
and then inserting the variable into my pages, I'm now at a loss...
I have the following MySQL query:
mysql> SELECT
-> YEAR(CURDATE()) - YEAR(birthday)
-> - IF(RIGHT(CURDATE(),5) < RIGHT(birthday,5),1,0)
-> AS 'age in years'
-> FROM users WHERE loginName="test";
which apparently will calculate age from date of birth.
The field in my table for date of birth is 'Dob'.
How do I make this into something in my code which will let me display the age on my page?
Thanks, in hope,
Debs