Support » Fixing WordPress » How to update datebase?

  • I want to count the number that how many people visited my post.My code is following:
    function post_viewnum(){
    global $wpdb;
    $postviewnum=$wpdb->get_var(“SELECT viewnum FROM wp_posts WHERE ID=’$postid'”);
    $wpdb->query(“UPDATE wp_posts SET viewnum='{$postviewnum}’ Where ID=’$postid'”);
    echo $postviewnum;
    The trouble is i can’t get the viewnum,and can’t update its datebase.

  • The topic ‘How to update datebase?’ is closed to new replies.