Platon Technologies
neprihlásený Prihlásiť Registrácia
SlovakEnglish
open source software development oslavujeme 10 rokov vývoja otvoreného softvéru! Streda, 25. november 2026
O nás
Magazín
Otvorený softvér
CVS
Služby
Index  »  Projekty  »  phpMyEdit  »  Fórum  »  Display Column Count

phpMyEdit General     Display Column Count
Odoslať novú tému   Odpovedať na tému    
 
Roy_W     Založený: 09.09.2005   Príspevky: 3  
Príspevok Zaslal: 2006-07-05 17:04
Návrat hore  Odpovedať s citátom     

I would like to add a dummy column that displays a "count" of items that are held within a seperate table.

(This is the table that I currently display)
TableJourney:

1 : JourneyID: Primary Key
2 : JourneyDepart
3 : JourneyDestination

(This is the table from which I wish to obtain the Passenger count)
TablePassengerJourneyList:

1 : PassengerListID:Primary Key
2 : JourneyIDFKey : ForeignKey
3 : PassengerID : ForeignKey

I have no problem displaying the "dummy" column,
or with URL linking.

I have tried using
sql => 'SELECT count(*) from TablePassengerJourneyList WHERE JourneyIDFKey = JourneyID'

But it only ever returns errors.

Has anyone managed this before,

Cheers Roy

 
phredbroughton     Založený: 07.03.2004   Príspevky: 17  
Príspevok Zaslal: 2006-07-29 23:54
Návrat hore  Odpovedať s citátom     

I realize this is an old post and my have been answered somewhere, but since I was trying to do this and this is the post I found in my search, I thought I would post the code that worked for me in case someone else ended up here like me ;-)

Example:
Table categories (PMEtable0)
Table files contains field cid which contains the category record id.
In the config for listing the categories for selection I added this field to display the count of files belonging to each category.
Kód:

$opts['fdd']['virtual_01'] = array(
   'name' => 'File Count',
   'select' => 'V',
   'options' => 'L', // Only list
   'maxlen' => 1,
   'sort' => false,
   'sql' => ' (Select count(fid) from files where cid=PMEtable0.cid)',
   'display' => 'V'
);

This is working with out CVS version using stable 5.5 release

 
Roy_W     Založený: 09.09.2005   Príspevky: 3  
Príspevok Zaslal: 2006-08-02 15:31
Návrat hore  Odpovedať s citátom     

Hi phredbroughton

Excellent that was exactly what I was looking for.
Just to take it a little further, I made it a clickable link by adding the following line

$opts['fdd']['virtual_01']['URL'] = 'index.php?selection=$value';

[Obviously the CGI Variables names will have to be adjusted accrding to need ]

Thanks Roy

 
Odoslať novú tému   Odpovedať na tému    

Copyright © 2002-2006 Platon Group
Stránka používa redakčný systém Metafox
Na začiatok · Odkazový formulár · Prihláška
Upozorniť na chybu na PLATON.SK webstránke · Podmienky použitia · Ochrana osobných údajov