Platon Technologies
neprihlásený Prihlásiť Registrácia
SlovakEnglish
open source software development oslavujeme 10 rokov vývoja otvoreného softvéru! Piatok, 19. apríl 2024
O nás
Magazín
Otvorený softvér
CVS
Služby
Index  »  Projekty  »  phpMyEdit  »  Fórum  »  Row Numbering

phpMyEdit General     Row Numbering
Odoslať novú tému   Odpovedať na tému   Choď na stránku 1, 2  Ďalší  
 
Taffman     Založený: 09.05.2014   Príspevky: 5  
Príspevok Zaslal: 2014-05-22 12:31
Návrat hore  Odpovedať s citátom     

I'm using PHPMyEdit to output a static list, i.e. sorting and filtering disabled. I'd like to add a column that numbers each row e.g. first row output is Row #1, the second Row#2 etc to the end of the list. Anyone know if an easy way to do this?

 
doug     Založený: 10.02.2003   Príspevky: 1013   Bydlisko: Denver, Colorado (USA)
Príspevok Zaslal: 2014-05-22 17:41
Návrat hore  Odpovedať s citátom     

No easy method is apparent.

You might make a copy of the class file, hack it, look at function list_table(), install a new variable like $rowCount = 0, and increment as $rowCount++ in a logical location in a while() loop and echo a new TD tag to display $rowCount. And if successful, maybe post your hack in the forum for other users who may search for such a hack.

 
trister     Založený: 01.12.2010   Príspevky: 15  
Príspevok Zaslal: 2014-10-01 21:04
Návrat hore  Odpovedať s citátom     

Try This It's been some time that I've written this so I hope this works with only minor modifications (just add a column/field name you use):

$opts['fdd']['dummy1'] = array(
'name' => 'CALC : ',
'select' => 'N',
'input' => 'R',
'options' => 'VLF', // MUST BE THIS for (virtual Field)
'php' => 'row_count.php',
'sql|VLF' => 'ROUND(one_field_used_for_counting)' , //query is in main_include
'sort' => true
);

row_count.php:
<?php
global $row_count,$opts;
$current_page=intval($this->fm / $this->inc)+1-1 ;
$row_count++;
$row_count_result=$row_count+($opts['inc']*$current_page);

return $row_count_result;
?>

 
mexman     Založený: 01.05.2016   Príspevky: 9  
Príspevok Zaslal: 2016-05-03 02:44
Návrat hore  Odpovedať s citátom     

Hi trister,

seems there was no feedback on your proposal.
I will try that, if your could help me a bit:


trister Napísal:


$opts['fdd']['dummy1'] = array(
'name' => 'CALC : ',
'select' => 'N',
'input' => 'R',
'options' => 'VLF', // MUST BE THIS for (virtual Field)
'php' => 'row_count.php',
'sql|VLF' => 'ROUND(one_field_used_for_counting)' , //query is in main_include
'sort' => true
);


WHERE does that go?

trister Napísal:

row_count.php:
<?php
global $row_count,$opts;
$current_page=intval($this->fm / $this->inc)+1-1 ;
$row_count++;
$row_count_result=$row_count+($opts['inc']*$current_page);

return $row_count_result;
?>


and THAT?

Sorry... I am a real dummy.
I was thinking of that: While the table is generated there must be a loop anywhere generating line by line.
Wouldnt it be possible to just "echo" that loop value in the leftmost column which just shows the "VIEW" button?

regards
Michael

 
mischa     Založený: 07.05.2016   Príspevky: 10  
Príspevok Zaslal: 2016-05-07 13:04
Návrat hore  Odpovedať s citátom     

Hi,
I am trying to make that work, but I am not good in PHP....

What is wrong with this:

global $row_count,$opts;
$current_page=intval($this->fm / $this->inc)+1-1 ;
$row_count++;
$row_count_result=$row_count+($opts['inc']*$current_page);
return $row_count_result;

because I am getting an error:
"Using $this when not in object context" but I dont understand that.

Can somebody give me a hint?

Regards
Michael

 
doug     Založený: 10.02.2003   Príspevky: 1013   Bydlisko: Denver, Colorado (USA)
Príspevok Zaslal: 2016-05-07 22:54
Návrat hore  Odpovedať s citátom     

Open the class file.

Use your text editor to search for "Display and accumulate column aggregation info, do totalling query"

Go up in the script a few lines until you see:
echo '</tr>',"\n";

Paste this ahead of that /tr tag:
echo '<td>'.(1 + $rowCount++).'</td>';

Then you have:
echo '<td>'.(1 + $rowCount++).'</td>';
echo '</tr>',"\n";

The last displayed column will contain a row number. If you want this displayed elsewhere, experiment on your own.

 
mischa     Založený: 07.05.2016   Príspevky: 10  
Príspevok Zaslal: 2016-05-08 02:56
Návrat hore  Odpovedať s citátom     

Hi Doug,

thank you very much, you made my day!
I would not have found that, as my PHP knowledge is very low level.
I will try to find out how to put the numbers in the first column instead tha last one, but at the moment THIS will work already!

Michael

 
mischa     Založený: 07.05.2016   Príspevky: 10  
Príspevok Zaslal: 2016-05-08 03:14
Návrat hore  Odpovedať s citátom     

Hi Doug,
I found a small issue and maybe you have a quick fix as well:

YOUR solution generates consecutive numbers only for one page!

I am dealing with a winners list and want to show the place from 1st (winner), 2nd, 3rd etc.
If I have e.g. 100 participants, I can see 1....20 on the first page and 1...20 on the second page. I would prefer to see 1...20 on the first page and the 21...40 on the second page and so on.
Do you think this is possible?

Regards
Michael

 
doug     Založený: 10.02.2003   Príspevky: 1013   Bydlisko: Denver, Colorado (USA)
Príspevok Zaslal: 2016-05-08 04:47
Návrat hore  Odpovedať s citátom     

It would be easier to create a new field to contain the winner's position. Maybe you can use phpmyadmin and some sort of SQL query to modify the value of the new field based on their score / result. This is where the data should reside, not in some hack of the class file.

 
mischa     Založený: 07.05.2016   Príspevky: 10  
Príspevok Zaslal: 2016-05-08 13:21
Návrat hore  Odpovedať s citátom     

doug Napísal:
It would be easier to create a new field to contain the winner's position. Maybe you can use phpmyadmin and some sort of SQL query to modify the value of the new field based on their score / result. This is where the data should reside, not in some hack of the class file.


I should explain better.
This is not a static field.
The database is here:
http://www.ecotec2000.de/myphp/jimbase
So the consecutive number shows the winners for all races, all years.
But then I can filter by YEAR of the race, and can then see e.g. the winners of THIS specific YEAR, or AGE GROUP, or the placement of the FEMALE participants in AGE GROUP F35 only in 1990 so sometimes the filter results are longer than one page and one has to scroll through the pages.

So building a static column in the database is not possible
because a person might be in place 1 in her age group, in place 20 in THAT year or in place 100 overall.

Actually, as you can see, my workaround is

$opts['inc'] = -1;

in order to avoid building several pages, but the final database will contain tens of thousands of entries, so I am expecting timing problems....


Thank you very much for your help.

Regards
Michael

 
doug     Založený: 10.02.2003   Príspevky: 1013   Bydlisko: Denver, Colorado (USA)
Príspevok Zaslal: 2016-05-08 15:39
Návrat hore  Odpovedať s citátom     

Custom programming in PHP is probably the best solution, but if continuing with phpmyedit then enhance query time by avoiding usage of drop down goto page navigation. Use the forum feature, search for goto.

 
mischa     Založený: 07.05.2016   Príspevky: 10  
Príspevok Zaslal: 2016-05-08 19:14
Návrat hore  Odpovedať s citátom     

doug Napísal:
Custom programming in PHP is probably the best solution,


No doubt about that... but as I said..... I am a PHP dummy....
I used to learn FORTRAN, BASIC and PASCAL ;-) and HTML.....Embedded programming..... ULF/LF/AF/HF/RF/UHF..... horse riding, scuba diving, hang gliding.... German, English, French, Spanish, Turkish and Mandarin... so enough for my life I guess ;-)
Too old now!
And I am rather an old HARDWARE than a software guy.

doug Napísal:
but if continuing with phpmyedit then enhance query time by avoiding usage of drop down goto page navigation.


Yes, I did that already!

Will check out the performance with final data base,
That is about 50.000 datasets.
Each dataset is small so I hope, access and filtering time will be acceptable.

Thanks again for your extensive help.... I was so happy to find that piece of software. I even did not know WHAT to look for, I just wanted to have a database retrieval tool and I am very happy I could make that work up to the level it is working now!



Regards
Michael

 
sozize     Založený: 16.09.2022   Príspevky: 1  
Príspevok Zaslal: 2022-09-16 18:57
Návrat hore  Odpovedať s citátom     

Since I went for the one-year membership plan, soon I got a call from a gifted expert via telephone. However, it required investment for the expert to figure out my concern yet I value that I didn't get that prearranged reaction that we typically get for other free https://knowledgestech.com/ specialized specialist organizations, as after conversing with those you want to waste your time in disappointment. The iYogi specialist dealt with me like a client however didn't expect that I didn't know anything.

 
itsanjali     Založený: 03.09.2022   Príspevky: 11  
Príspevok Zaslal: 2022-09-17 06:52
Návrat hore  Odpovedať s citátom     

I&#8217;m always trying to improve my newborn photography blog. It takes time and practice to produce more quality content people can connect with.
Escorts in Dharamshala |
Haldwani Escorts |
Haridwar Call Girls |
Call Girls in Jim Corbett National Park |
Ecorts Service in Kasol ||||

 
itsanjali     Založený: 03.09.2022   Príspevky: 11  
Príspevok Zaslal: 2022-09-17 06:59
Návrat hore  Odpovedať s citátom     

I&#8217;m always trying to improve my newborn photography blog. It takes time and practice to produce more quality content people can connect with.

Escorts in Mallroad Mussoorie |
Mcleodganj Escorts |
Mohali Escorts Service |
Escorts Service in Rishikesh |
Mussoorie Call Girls | ||

 
Odoslať novú tému   Odpovedať na tému   Choď na stránku 1, 2  Ďalší  

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