last record

runza

Member
hie

i find a way to display the last record of a table from the menu link

i know that i can use a limit 1 on a sql query and use the prefilter
but i don"t achieve it

i use a calc element without success
$db =& JFactory::getDBO();
$db->setQuery("SELECT `date_time` , `departement` , `ville` , `nom` , `pdf` FROM `compterendues` LIMIT 1");
$rows = $db->loadObjectList();

philippe
 
What is the "last" record? the one with the greatest id? or a special (maximum) date?

Do you want to show the list view with only this record or a details or form view?

Where did you try the calc element?
 
Pre-filters

i don't understand what does it mean "other fields from..."

i try this Pre-filters (image attached ) but it seem to doesn't work
philippe
 

Attachments

  • calc-max-id.gif
    calc-max-id.gif
    4.5 KB · Views: 137
The calc would be something like....

Code:
$db =&JFactory::getDBO();
$db->setQuery("SELECT `date_time` , `departement` , `ville` , `nom` , `pdf` FROM `compterendues` ORDER BY `id` DESC LIMIT 1");
$row = $db->LoadRow();
return $row;
 
Did you install the calc manually from discover?

You may have to perform a Github update so your Fabrik files are in sync.
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top