view counter issue

Discussion in 'General PHP' started by skyhigh, Mar 2, 2019.

  1. skyhigh

    skyhigh Member

    Joined:
    Sep 28, 2010
    Messages:
    446
    Likes Received:
    8
    hello all how u doing ok so am using this view counter

    // sort out counter

    PHP:
    if (empty($auction_data['counter']))
    {
        
    $query "INSERT INTO `" $DBPrefix "auccounter` (`auction_id`, `counter`) VALUES :)counter, 1)";
        
    $params = array();
        
    $params[] = array(':counter'$id'int');
        
    $db->query($query$params);
        
    $auction_data['counter'] = 1;
    }
    else
    {
      
        if (!
    in_array($id$_SESSION['WEBID_VIEWED_AUCTIONS']))
        {
            
    $query "UPDATE " $DBPrefix "auccounter set counter = counter + 1 WHERE auction_id = :auction_id";
            
    $params = array();
            
    $params[] = array(':auction_id'$id'int');
            
    $db->query($query$params);
            
    $_SESSION['WEBID_VIEWED_AUCTIONS'][] = $id;
        }
    }
    it works but it keep jumping

    from 1 it jumps to 3 sometime from 3 it goes to 8 and then start working well any assist on what making it to act this way will be grateful thanks

    it suppose to b a session counter
     

Share This Page