php - How to store a Rating -


im working on website display pictures, , pictures have 5 stars rating.

the question is, where, or how can store rating of each pic.

example: subject 1 gives 4 stars picture( how can store rating)
subject 2 gives 2 stars picture.

so picture have 3 start rating

im using html, css, php, , mysql.

is there way of storing in mysql rating?

hope can me.

save rating so:

insert ranting (picture_id, user_id, ranting) value (1, 1, 5); 

and average, follows:

select avg(ranting) ranting, count(ranting) total ranting picture_id=1; 

Comments

Popular posts from this blog

PySide and Qt Properties: Connecting signals from Python to QML -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

scala - 'wrong top statement declaration' when using slick in IntelliJ -