Calling from data base for form; almost solved, help?

Have a programming question regarding your component, plug-in, extension or core hacks? Have an interesting tidbit, FAQ or programming tip you’d like to share? This is the place for you.

Moderators: tjay, seadap, Rogue4ngel, matthewhayashida

Post Reply
andrewvanmarle
Joomla! Apprentice
Joomla! Apprentice
Posts: 7
Joined: Fri Jun 08, 2007 3:14 pm

Calling from data base for form; almost solved, help?

Post by andrewvanmarle » Tue Mar 04, 2008 10:31 pm

I'm calling info from the database to autofill some fields in Facile Forms. I enter the code as value, and it works great. Now i need to do this in an advanced manner...

the original code:

Code: Select all

<?php global $database,$my; $query = "SELECT cb_roepnaam FROM #__comprofiler WHERE id = ". $my->id;  
$database->setQuery( $query ); $fieldvalue = $database->loadResult(); return $fieldvalue;?> 
where cb_roepnaam is the data to be auto filled in (dutch for first name).

What I want to do now is to make the same call, but, call 4 fields and add a carriage return after the first three so they showone below the other. (this is to create an address) the fields are: cb_street, cb_postalc, cb_town and cb_country. How do I do that?

the other thing I'm trying is this:
to calculate an age (at a future date) using the cb_birthdate field
the query would probably look like this:

Code: Select all

<?php global $database,$my; $query = "SELECT DATE_FORMAT(FROM_DAYS(TO_DAYS('13-6-2008') - TO_DAYS(cb_birthdate)), '%Y') + 0 AS Age FROM FROM #__comprofiler WHERE id = ". $my->id;  
$database->setQuery( $query ); $fieldvalue = $database->loadResult(); return $fieldvalue;?> 
but it does't return any value, can anyone see why?

Thanks in advance!!

Post Reply