I’m working on a project to add statistics for pageviews. I’m having trouble looking up and then storing in MySQL from PHP.
I have users stored in the database as:
ID Email_Address Visits
1 email@address.com NULL
2 email@address.com NULL
A variable is passed into the page called $ID which refers to which user has been visited.
Firstly, should the Visits column be a default of 0 rather than NULL?
Secondly, What query can I then use to go something like;
Lookup $ID, add 1 to Visits in that row. ie: Visits = Visits + 1?
Also if $ID is blank, it shouldn’t do anything.
Cheers
Yes, it should be default of
0.If the
idis blank, don’t run the query.