Forum Moderators: coopster
<?php
$resultVs = mysql_query("SELECT views FROM page LIMIT 1") or die(mysql_error());
while($rVs = mysql_fetch_array($resultVs)) { $viws = $rVs['views']; } $viws = ($viws+1);
mysql_query("UPDATE page SET views='$viws'") or die(mysql_error());
?> <?php
mysql_query("UPDATE page SET views=(views+1)") or die(mysql_error());
?>
This will update all page records in the table though - i dont know how your system is setup but you might want to specify which record you want to update eg.
<?php
mysql_query("UPDATE page SET views=(views+1) WHERE pageName = 'homepage'") or die(mysql_error());
?>
Hope this helps
Ally
1) Process index page
2) Check for URL request
3) If URL request, Run Index page
4) If URL request, Run Index & Included pages
5) If no URL request, Run 404 page
I worked this out by telling the page to write to "INDEX_DUMP.LOG"
I used a custom log format, so I could understand the output
This is what I got;
// LANGUAGE: "Simplified Jargon"
//// AUTHOR: "Ryan (Noggin) Boylett"
/// VERSION: "3.0.1"
///// TITLE: "INDEX_DUMP.LOG"
== RUN INDEX PAGE
== PHP CODE INITIALIZED ENTITLED "?"
== PHP CODE IF STATEMENT
== PHP CODE IFTRUE REDIRECT PAGE TO \nINDEX
== PHP CODE IFTRUE PROCESS PAGE INDEX
== PHP CODE IFTRUE PROCESS PAGE INDEX&&'res/inc/home.php'
== PHP CODE IFFALSE PROCESS PAGE INDEX&&'res/inc/404.php'
So, I just added the MySQL code to every include page (which appears to only process once), and it works!