Counting how many times a rating was entered in a MySQL Database using PHP -
i'm trying count how many times article has been rated members buy using php count articles total entered ratings have been stored in mysql database.
i want use php , not mysql , wondering how can this?
i hope explained right?
an example helpful mysql database holds ratings listed below.
here mysql database.
create table articles_ratings ( id int unsigned not null auto_increment, ratings_id int unsigned not null, users_articles_id int unsigned not null, user_id int unsigned not null, date_created datetime not null, primary key (id) ); create table ratings ( id int unsigned not null auto_increment, points float unsigned not null default 0, primary key (id) );
it's easier sql:
select count(*) articles_ratings id = (id value)
you of course select * articles_ratings id = (id value)
, loop through rows count them -- if database can work you, it's best use it!
Comments
Post a Comment