mysql - Please help me in php mysq to count data by group -


i have table clicks this

+-----+-----+-------+-------+ |  id |   time   |   site   | +-----+-----+-------+-------+ |  1  | 8 4 2013 |   site1  | |  2  | 8 4 2013 |   site1  | |  3  | 9 4 2013 |   site2  |  |  4  | 6 4 2013 |   site1  | +-----+-----+------+--------+ 

i want show result this

   date      |       count   8 4 2013   |       2 click   6 4 2013   |       1 click 

i have code

$id = 'site1'; $getclk = mysql_query("select * clicks site='$id'"); $clk = mysql_num_rows($getclk); print $clk; 

this code show count of rows , want show count of row grouped time.

group command works don't know how this.

please me dont know how this, please give me full code this.

i think should be:

select count (id) countclicks, time date clicks [where site = ?] group time order countclicks desc 

also, shouldn't use mysql_* functions because deprecated.


Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -