Copy link to clipboard
Copied
I have a dynamic website through php and mysql. How do I get my website to keep track of the amount of views each entry got (and for the amount of views to be recorded in my mysql table? Is there an easy way to do this with dreamweaver?
i do have a column for views but i have do not know how the results would be inputed.
how do i use that "update statement" you mentioned to input increment view amounts in my column?
table_name has column for views.
page is a column in table that is used to dynamically display content based on title in URL parameter ie
website.com/?page=home
website.com/?page=about_us
etc.
Use query to update views+1 where page = the URL parameter that is entered into address bar to display the dynamic page content.
...$pa
Copy link to clipboard
Copied
>Is there an easy way to
>do this with dreamweaver?
I don't know of a server behavior that will do this, but it's very easy to code. Everytime you retrieve the item for viewing, you also issue an update statement that increments a counter in the table. Does your 'item' table already have a column for counting views? That would probably be a good place to put it, but it's hard to say without knowing more about your database design.
Copy link to clipboard
Copied
breqent,
i do have a column for views but i have do not know how the results would be inputed.
how do i use that "update statement" you mentioned to input increment view amounts in my column?
I am a beginner to php and mysql and have some difficulty venturing farther than (or even deciphering) dreamweaver's php code.
thanks,
YWSW
Copy link to clipboard
Copied
i do have a column for views but i have do not know how the results would be inputed.
how do i use that "update statement" you mentioned to input increment view amounts in my column?
table_name has column for views.
page is a column in table that is used to dynamically display content based on title in URL parameter ie
website.com/?page=home
website.com/?page=about_us
etc.
Use query to update views+1 where page = the URL parameter that is entered into address bar to display the dynamic page content.
$page = "-1"; if (isset($_GET['page'])) { $page = $_GET['page'];
$query_hits = sprintf("UPDATE table_name
SET views = views+1
WHERE page = %s", GetSQLValueString($page, "text"));
$hits = mysql_query($query_hits, $connection) or die(mysql_error());
}
best,
Shocker ![]()
Copy link to clipboard
Copied
perfect.
shockingly simple ![]()
Find more inspiration, events, and resources on the new Adobe Community
Explore Now