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/MyPages/web%20app.php

How would I do so?
Thanks in advance! :)

Recommended Answers

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/MyPages/web%20app.php

How would I do so?
Thanks in advance! :)

Are …

Jump to Post

All 2 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/MyPages/web%20app.php

How would I do so?
Thanks in advance! :)

Are you counting rows or columns? Either way, you might want to use PHP.

Count rows:

substr_count($table, '<tr>');

Count columns:

$row = preg_replace('/.*\<\tr>(.*?)\<\/tr>.*/','$1',$table);
substr_count($row, '<td>');

Could also use jquery

$('#tableID tr').size()
or
$('#tableID tr').length()
or
$('#tableID tr').count()
Be a part of the DaniWeb community

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