Platon Technologies
not logged in Login Registration
EnglishSlovak
open source software development celebrating 10 years of open source development! Wednesday, November 11, 2026
About Us
Magazine
Open Source
CVS
Services
Index  »  Projects  »  phpMyEdit  »  Forum  »  Display Column Count

phpMyEdit General     Display Column Count
Post new topic   Reply to topic    
 
Roy_W     Joined: 09 Sep 2005   Posts: 3  
Post Posted: 2006-07-05 17:04
Back to top  Reply with quote     

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     Joined: 07 Mar 2004   Posts: 17  
Post Posted: 2006-07-29 23:54
Back to top  Reply with quote     

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.
Code:

$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     Joined: 09 Sep 2005   Posts: 3  
Post Posted: 2006-08-02 15:31
Back to top  Reply with quote     

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

 
Post new topic   Reply to topic    

Copyright © 2002-2006 Platon Group
Site powered by Metafox CMS
Go to Top · Feedback form · Application form
Report bug on PLATON.SK website · Terms of use · Privacy policy