hi have this script that update its table accounter
but the script seem to update when i refresh the page i havent even figure out the button click to update the table +1 instead when i refresh the browser i get updated, plz what am i doing wrong here and how do i add the button that will b click to download d file n update the table +1.
thanks\
if (isset($_POST['action']) && $_POST['action'] == 'update')
{
//all_clicked
$query = "INSERT INTO `" . $DBPrefix . "auccounter` (`auction_id`, `download_counter`) VALUES (:download_counter, 1)";
$params = array();
$params[] = array(':download_counter', $id, 'int');
$db->query($query, $params);
$auction_data['download_counter'] = 1;
}
else{
$query = "UPDATE " . $DBPrefix . "auccounter set download_counter = download_counter + 1 WHERE auction_id = :auction_id";
$params = array();
$params[] = array(':auction_id', $id, 'int');
$db->query($query, $params);
}
while ($row = $db->fetch())
{
$template->assign_block_vars('click', array(
'DOWNLOAD' => $auction_data['download_counter']
));
}