PHP Count how many times code is used on a page

user1610904

On a page, I have multiple instances of the below code, which grabs snippets of info depending on the ID. If possible, I simply need a way to count exaclty how many times the below code is used on that page. So if I pasted that code 17 times with 17 different IDs, I need a way to generate that total number (17).

I've tried adding things like $count++ to every instance and then getting the total with $count, but that only works if the total is below all the instances. But in this case I need the total at the top of the page. Any ideas?

<? $rs= mysql_query("select id from Files $order");
while ($row= mysql_fetch_array($rs)) {  
$idnumber = 2696;
require("row.php");
} ?>
vch

If by "page" you mean HTML page, you could just include something like:

<div style="display:none" class="count-me"></div>

after each closing ?>. Then use jQuery to count the number of times it sees that class and output that somewhere on your page:

<script>
     $('#id-of element-where-you-output-number').text( $('.count-me').length );
</script>

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Is there a formula that will count how many times "@" is used in a cell?

From Java

How many times the word is used on the html page

From Dev

Count How Many Times a Value Appears Php

From Dev

How to count how many times a global variable was used (read and write)?

From Dev

PHP function or how to use this code many times in different instances on one page, not using php include

From Dev

How to find how many times a code was used in the past 5 years

From Dev

How to count how many times a number is repeated in a list( and if a number is not used based on values from another list )?

From Dev

How to use REGEX to read through a .txt file and count how many times words are used and add that info to a dictionary

From Dev

I can't count how many times same chars used in file

From Dev

How to count how many times a string occurs

From Dev

how to count how many times a loop was executed?

From Dev

how to count how many times a user logs in?

From Dev

Is it possible for a macro to expand to code that will be executed exactly once when a program starts, regardless of how many times it's used?

From PHP

Count how many times something was echoed in a range?

From Dev

Count how many times the button is clicked in angularjs

From Dev

SQL COUNT how many times a value appears

From Dev

Count how many times a value appears in this array?

From Dev

Count how many times a word exist in column

From Dev

count and display how many times data in SQL

From Dev

Count how many times a character changes in a string

From Dev

Count how many times the data appear in a table

From Dev

Count How Many Times Customer Has Purchases

From Dev

Count how many number of times a value appears

From Dev

how to count how many times a while statment has run php and sql

From Dev

How do I get a count of how many times a certain number is inside of a json file using php?

From Dev

show same id one time but in column count how many times php

From Dev

Access: count how many time an item is used

From Dev

Count, in how many sheets was the word used

From Dev

Means to count how many times a recursion was called or how to identify if all recursions were done and the code returned to the first call

Related Related

  1. 1

    Is there a formula that will count how many times "@" is used in a cell?

  2. 2

    How many times the word is used on the html page

  3. 3

    Count How Many Times a Value Appears Php

  4. 4

    How to count how many times a global variable was used (read and write)?

  5. 5

    PHP function or how to use this code many times in different instances on one page, not using php include

  6. 6

    How to find how many times a code was used in the past 5 years

  7. 7

    How to count how many times a number is repeated in a list( and if a number is not used based on values from another list )?

  8. 8

    How to use REGEX to read through a .txt file and count how many times words are used and add that info to a dictionary

  9. 9

    I can't count how many times same chars used in file

  10. 10

    How to count how many times a string occurs

  11. 11

    how to count how many times a loop was executed?

  12. 12

    how to count how many times a user logs in?

  13. 13

    Is it possible for a macro to expand to code that will be executed exactly once when a program starts, regardless of how many times it's used?

  14. 14

    Count how many times something was echoed in a range?

  15. 15

    Count how many times the button is clicked in angularjs

  16. 16

    SQL COUNT how many times a value appears

  17. 17

    Count how many times a value appears in this array?

  18. 18

    Count how many times a word exist in column

  19. 19

    count and display how many times data in SQL

  20. 20

    Count how many times a character changes in a string

  21. 21

    Count how many times the data appear in a table

  22. 22

    Count How Many Times Customer Has Purchases

  23. 23

    Count how many number of times a value appears

  24. 24

    how to count how many times a while statment has run php and sql

  25. 25

    How do I get a count of how many times a certain number is inside of a json file using php?

  26. 26

    show same id one time but in column count how many times php

  27. 27

    Access: count how many time an item is used

  28. 28

    Count, in how many sheets was the word used

  29. 29

    Means to count how many times a recursion was called or how to identify if all recursions were done and the code returned to the first call

HotTag

Archive