page views and page like count by date wise for the particular page php mysql -


i want store views , counts particular page .

im using page url unique key (index.php),

in table have following columns

common table

id   |   page name    |  views    |    likes     |   timestamp    1   |   index.php    |    5      |      3       |   6-2-2014     2   |   abount.php   |   15      |     77       |   6-2-2014    

for views table

id   |   page name    |  date    |   ip     1   |   index.php    | 6-2-2014 | 127.0.0.1  2   |   index.php    | 6-2-2014 | 127.0.0.2  3   |   index.php    | 6-2-2014 | 127.0.0.3  4   |   index.php    | 6-2-2014 | 127.0.0.4  5   |   index.php    | 6-2-2014 | 127.0.0.5 

for table

id   |   page name    |  date    |   ip     1   |   index.php    | 6-2-2014 | 127.0.0.1  2   |   index.php    | 6-2-2014 | 127.0.0.2  3   |   index.php    | 6-2-2014 | 127.0.0.3 

what im did here means , every time insert new record in count table increase count particular page in common table ,

1) here allowed 1 time particular page 1 ip.
2) need know how daily views , likes reports .

i know have maintaining complicated tables , simplification approach

sorry english

the comments creating foreign key page_id , should @ those. however, question how daily summary reports.

this give daily views (the same apply likes):

select page_name, date, count(ip) viewcount views group page_name, date order page_name, date  -- can select ordering... 

Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -