I am trying to use Dreamweaver to build a Lyrics database website. I have a table for the lyrics and I have a column called "views" that I want to increase by 1 every time that particular lyric is viewed in a browser.
How can I accomplish this using mysql? What mysql datatype Or PHP can I use?
Please explain thoroughly because I do not know php or mysql that well, I'm just trying.
Remember I am using Dreamweaver.
Thanks.
I've never been a fan of a 'views' column because there is no proof that is the actual number, instead I would create a transaction table where I would store a timestamp along with some other info, then if I wanted to get a count of how many times the lyrics were viewed I would just do:
For demonstration purposes, the table design might look like:
Well we would need to see how your PHP and MySQL is laid out to be honest. Do you want someone to just write it for you or do you want to learn?
The query would be something like this:
I believe that would work.
id
is your lyric id andcount
is your column for keeping track of numbers.and have that execute every time the lyrics page is loaded.