• Well, i read somewere that there already is one, and that sucks. But well, i’ve had fun making it, and I just wanted to show it here. It’s xl simple, because you just have to add this within ,,the loop”:
    <?php views() ?>
    It genrates a new row in the database automatically. Yes i know, you’re all asthonised by this wonderfull plugin …
    If i’m online my sever is also, you can find the stuff here and here.
    When i’m not online:
    <?php
    /*
    Plugin Name: PPP (Pageviews Per Post)
    Plugin URI: https://schot.xs4all.nl/index.php?p=3
    Description: Pageview counter for posts, automatic. My site is online, when i'm online ;)
    Version: .01b
    Author: jmschot
    Author URI: https://schot.xs4all.nl
    */

    function views() {
    $count_id = $_GET['p'];
    if ($count_id == NULL) {
    global $id;
    $result = mysql_query("
    select *
    from wp_count
    where count_id='".$id."'");
    $r=mysql_fetch_array($result);
    echo $r[count] . " pageviews";
    return;
    }
    $result = mysql_query("
    select *
    from wp_count
    where count_id='".$count_id."'");
    $r = mysql_fetch_array($result);
    if ($r[count] == NULL) {
    $create = mysql_query("
    insert into wp_count
    (count, count_id)".
    "VALUES (1, '$count_id')");
    $pageviews = "1";
    }
    else {
    $update = mysql_query("
    update wp_count
    set count = count+1
    where count_id='".$count_id."'");
    $pageviews = $r[count]+1;
    }
    echo $pageviews . " pageviews";
    }
    ?>
    CREATE TABLE ‘wp_count’ (
    ‘count’ varchar(255) NOT NULL default ”,
    ‘count_id’ varchar(25) NOT NULL default ”
    ) TYPE=MyISAM
    Later

Viewing 5 replies - 16 through 20 (of 20 total)
  • I still can’t get it to work and I added the most recent version of the code to my-hacks.php

    Thread Starter jmschot

    (@jmschot)

    hi, well im sorry, but i dont know what’s wrong than. if it’s still the table creating, maby you should try creating the table yourself?

    I installed this plugin, I had to create the table myself, it worked fine just by letting phpadmin interface for query use the .sql file.
    But with this plugin activated in the WP 1.2 admin interface, and the code in the loop on index.php, the page only loads to the point where that code is, then it stops. So, it doensn’t work, it’s doing SOMETHING since the page only partially loads, but it’s not throwing a visible error other than that.
    I have the plugin deactivated and the code commented out on my index.php right now. I’d appreciate any help I can get with this though.

    Doesn’t work for me either, I get a mysql error, the table was created fine, but I get a “access denied for root@localhost”.

    Has anything been done on this? I’m looking for a plugin that does just this!

Viewing 5 replies - 16 through 20 (of 20 total)
  • The topic ‘Pageviews Plugin (ready)’ is closed to new replies.