In this tutorial, you will learn how to create a simple view counter with PHP and MySQL. Be sure to SUBSCRIBE because there will be a new tutorial every week.
Original source
In this tutorial, you will learn how to create a simple view counter with PHP and MySQL. Be sure to SUBSCRIBE because there will be a new tutorial every week.
Original source
26 responses to “PHP MySQL Tutorial: Create a Simple View Counter -HD-”
Thanks man, saved me a lot time. got it done right after you did id='1'. God Bless!
Thank you RCG .. 🙂 Its really helpful for us ..
I have to say "Thank you!!!!" for this video. I have seen many videos online. Your approach cover essential basic concepts without overwhelming learners and it simply works. Expanding it into more complex form belongs to learners. Subscribed.
very very good, thanks. Please add option for ignore my IP address in counter. THX!
Good job dude!
Thanks! Great tutorial!
it seems that ' ' is the same as ""?
What about “?
Can you explain the differences?
Can you make it count for one view per IP per day per page? Otherwise you get counts for refreshing.
Mate, i really appreciate your work. After watching a tutorials of other people who explain same staff but taking freaking 50 minutes or so comparing to your 15min (because of extremeley fast speaking – you need to do some freestyle btw). Amazing, thnx again 😀
i want to know how to make points system works? when user click on each item in the product list he gets certain points on each products. In other words, giving reward to customers if they spend more than £10.00 then they will get 10 points.
GREAAAAAAAAAAAT!!!!!
Why did you use a while loop?
Thanks!
But your MySQL query in php-code does't properly work for me.
On 5:06 You had written:
mysql_query ("UPDATE viewcounter set 'views'='views'+1 WHERE id='1'");
Correctly working variant for me:
mysql_query ("UPDATE viewcounter SET views = views+1 WHERE id=1");
PLEASE, explain to me, why is your query with apostrophes working well, but on my machine there was an syntax-error.
Thanks for this tutorial video. I wanted to know why in the UPDATE and SELECT statement the id field value, which is an integer and not a string, was enclosed in quotes.
Also, after retrieving the record into the $row variable, you could save a few steps by using the extract($row) method, which will create vars based on the keys of the array. How did php know to make $row an associative array instead of a numerically indexed array? I thought that you had to either call mysqli_fetch_array($sql, MYSQL_ASSOC) or call mysqli_fetch_array_assoc($sql).
In the code for the index counter, wouldn't it be simpler to use a single php statement such as <?php echo "<p>There are $views views on the $pagename page.</p>" ?> ? Thank you.
Thanks for another informative and easy to follow tutorial on PHP. It really brings home the concepts discussed in my textbook. Can you elaborate on the variable that was assigned to the query result? As a VB programmer, it seems to me that the variable is the equivalent of an ADO recordset object. Am I on the right track as far as grasping the basic idea? Many thanks for all your great work!
if i want this counter to my html page how can i do. because this counter is php file …
when i select "defined as" and "0" for my views column, it says it's invalid and won't let me save or proceed
thank you.. is this relevant to Object Oriented PHP 5 as well.. As these are basic features anyway.
thanks!
Thank you! You made learning how to extract data from a database so much easier to follow!! Keep doing these tutorials, you have taught me so much ! Thank you 🙂
THANK YOU! This tutorial was GREAT and EASY TO FOLLOW!
cool
thanks
How can i thank you
I have to thank you for taking the time to teach all of this to us. Much appreciated. Great presentation.
This was very helpful! Thanks again!