Hello all,
Is there any way that I can count the number of lines in one column in a table? Such as I want to count all the names in this column on First name:
http://www.globalvirtualairlines.com.../web%20app.php

How would I do so?
Thanks in advance!

Recommended Answers

All 10 Replies

Hello all,
Is there any way that I can count the number of lines in one column in a table? Such as I want to count all the names in this column on First name:
http://www.globalvirtualairlines.com.../web%20app.php

How would I do so?
Thanks in advance!

that's a dead link but I assume that you are talking about an html table with which you will need to loop through the Dom to get a count. I suggest you search google with "javascript count table cells" and will probably find someone who has already done it with an already made example of how it can be done.

is this your website or will be using a file_get_contents or curl or something like that?

No this is not my website. I am planning to use this as a web addon.
and i am not familiar with file_get_contents.

The reason I ask about column counting is because I had an Idea to make an Invisible table and use just one column, count the column contents as in count each line in the single Column.
And on the top of the page have one table with a row displaying how many First Names there are.

so how do you plan to pull in the html from this page? Or is that one of your questions?

Use this query to count single column from table

SELECT COUNT( FIRSTNAME ) FROM TABLE;

Interesting. Use some jquery by using DATATABLES it is a bit of a curve, but I learned it in 2 days.... http://www.datatables.net/examples/basic_init/zero_config.html

By typing what you need into the box you can get an exact extract of your entire list.

It is not hard, and is well worth learning, PLUS it is dynamic.

Interesting. Use some jquery by using DATATABLES it is a bit of a curve, but I learned it in 2 days.... http://www.datatables.net/examples/basic_init/zero_config.html

By typing what you need into the box you can get an exact extract of your entire list.

It is not hard, and is well worth learning, PLUS it is dynamic.

ok, and how do you plan to get around the cross domain ajax rule without using some type of JSON exchange?

won't "mysql_fetch_rows()" work?

R0bb0b, no cross domain stuff needed, its all on his site, I assumed some sort of pre-harvesting is ocuring and 1) he already has the data, and 2) it is just being burped out.

Re-reading the question and thinking about tamsofts response, perhaps the poster is looking for something like this:

SELECT distinct( FIRSTNAME ), COUNT( FIRSTNAME )
FROM tablename
group by FIRSTNAME;

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.