Source Code

/shortcode-plugin-template/components/backend/

counter.php

<?php
 
//Load data from the database
$row = $wpdb-> get_row("SELECT *  FROM ".$tablename." WHERE ID = 1");
$counter = $row->counter; 
 
//Update the data in the database if a GET request was issued
if(isset($_GET['increaseBy'])){
    $increaseBy  = $_GET['increaseBy'];
    if(is_numeric($increaseBy)){
        $counter = $counter + $increaseBy;
        $wpdb->update( $tablename, array( 'counter' => $counter),array('ID'=>'1'));
    }
}