Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,151,567 members, 7,812,836 topics. Date: Monday, 29 April 2024 at 08:19 PM

Php Record Counter - Webmasters - Nairaland

Nairaland Forum / Science/Technology / Webmasters / Php Record Counter (620 Views)

Php Or Html Code For Click Counter Needed Urgently / Inserting Hit Counter And Analogue Clock On Webpage / Hit Counter. (2) (3) (4)

(1) (Reply) (Go Down)

Php Record Counter by pagolina: 3:26pm On Jun 26, 2009
can some body help me?
am designing my application with php mysql.
i have about 100 record in a particular table,
i want to display some thing like this on a particular page

100 registered
26 female
74 male
80 member
20 pending

pls how do i get this statistic with phpmysql?
Re: Php Record Counter by TechPros(m): 4:21pm On Jun 26, 2009
do you have any other table aside the one with the 100 records? if you dont, i think you need one more for the pending member.
also you can post the application schematic, so we can have a better understand of how the application is suppose to work
Re: Php Record Counter by yawatide(f): 7:54pm On Jun 26, 2009
after what tech pros has said, which is called database normalization, you will need to use the "WHERE" clause to filter and the COUNT(*) statement to get the count. So it would go something like this (of course, verify for errors):

SELECT COUNT(*) FROM table_poster WHERE status = 'registered (or whatever you call it)'

Make sense?
Re: Php Record Counter by lojik(m): 3:28pm On Jun 29, 2009
//To get male and female
$sql=SELECT count(*) as total, sex FROM myTable GROUP BY sex

//to get registered and pending
$sql=SELECT count(*) as total, status FROM myTable GROUP BY status

//to count all members after running mysql_query
mysql_num_rows($result);
Re: Php Record Counter by Nobody: 7:44pm On Jun 29, 2009
Impressive. You guyz are just spewing codes without seein the structure of the table. U may be surprised that the table does not contain. . .
Re: Php Record Counter by yawatide(f): 9:13pm On Jun 29, 2009
dhtml, it is possible but the point of at least my code is not to provide answers based on his table structure but for the purpose of understanding where he needs to go.

The poster should be able to infer from our respective code snippets what he needs to do:
1) Get the number of rows
2) Filter the results, if applicable
3) group or order the results, if applicable.
Re: Php Record Counter by Nobody: 3:39am On Jun 30, 2009
Actually all the codes are ok. what i dont know is - if the OP has gotten the table correctly laid out with the right fields
before coming back here and say that our codes are not working.

(1) (Reply)

Capturing Ur Screen And Mouse Movement / I Need Some One Who Is Very Good In Adobe Flash Cs3 / Increase Your Business Relevance With A Simple Online Presence

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 13
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.