I coded my website from the book: Creating Interctive Websites with PHP and Web Services (Eric Rosebrock). http://www.warra-warra.co.za
Herewith the code that’s giving me nightmares!
switch ($_REQUEST[‘req’]) {
case “read”:
$sql = mysql_query(“SELECT *,
date_format(article_date, ‘%M %D, %Y’) as article_date
FROM article_articles WHERE article_id=’{$_GET[‘article_id’]}’”);
@mysql_query(“UPDATE article_articles
SET article_read_count = (article_read_count +1)
WHERE article_id = ‘{$_GET[‘article_id’]}’”);
$row = mysql_fetch_assoc($sql);
stripslashes(extract($row));
$cat_name = mysql_result(mysql_query(“SELECT cat_name
FROM article_categories
WHERE cat_id=’$cat_id’”),0);
myheader(“article $article_title”);
?>
The read count is working !Beautifully! however F5 escalates the read count.
I then wrote the following code which works (the escaling stopped!) but the counting only progresses up to “3” then the counting stops!
session_register (“blog_read_count”);
if (isset($blog_read_count)) {
$_SESSION[‘blog_read_count’] =1;
}
$_SESSION[‘blog_read_count’] ++;
$blog_read_count ++;
@mysql_query(“UPDATE blog_entry
SET blog_read_count = ‘{$_SESSION[‘blog_read_count’]}’
WHERE blog_id = ‘{$_GET[‘blog_id’]}’”);
It’s not that i’m a pro at PHP … i’m willing to learn and since i am jobless and hoped that i would generate an income from my website, i’m sitting with my hands in my hair which is greying by the hour! L0L
Please help me fix the problem.
Kind Regards
Willemien Lewis
(South Africa aka, The rainbow nation) - 'cept right now it’s clouded! 