php - I want to show the page views in a news site -


i want show page views in news site. that's why there cell name views.

i trying codes

$sql = "update posts set views=views+1 id=17184";  

in singlepage.php page. it's not working. use these codes?

some points more detail...

  1. i want increase value of views 1 in every reload/refresh of page singlepost.php

  2. when click on links index.php singlepost.php open detail of link

  3. let's see using codes , how using...

                        $sql = "update posts set views=views+1 id=17184"; 

you have ' around field names generate mysql error. suspect looking backtick stop mysql treating reserved words reserved words (ie: if have table called update, wrap table name in backticks)

most issue lies query. below i've updated you.

$sql = "update `posts` set `views`=`views`+1 `id`=17184";  

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -