PHP MySQL Tutorial: Create a Simple View Counter -HD-




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-”

  1. 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.

  2. 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 😀

  3. 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.

  4. 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.

  5. 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.

  6. 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!

Leave a Reply