Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 880123
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T12:02:38+00:00 2026-05-15T12:02:38+00:00

i want after i’ve been submit form it can show hit counter.. but i

  • 0

i want after i’ve been submit form it can show hit counter..
but i want after it reach “20” it can back to zero..bcoz the limit of submit is 20 times so it can’t over the limit.

how do i make it works?I’ve been try to this code…

<?
$limit="20";
$Query_counter=mysql_query("SELECT model FROM inspec");
$Show_counter=mysql_fetch_array($Query_counter);
$show_counter = $show_counter["model"]+1;

if($show_counter > $limit[0]) {
      $show_counter = 0;
}elseif ($show_counter > $limit[1]) {
      $show_counter = 0;
}


$Query_update=mysql_query("UPDATE inspec SET model=$Show_counter");
$Show_counter=number_format($Show_counter);
$Show_counter=str_replace(",",".",$Show_counter);
echo "Hit:</br><strong>$show_counter</strong>";
?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T12:02:39+00:00Added an answer on May 15, 2026 at 12:02 pm

    To make a counter go up to a certain value then loop back to zero, you can use the modulus operator, which in a lot of languages (including PHP and MySQL) is %

    $x = 0;
    $limit = 4;
    for ($i = 0; $i < 10; ++$i) {
        $x = ++$x % $limit;
        echo $x;
    }
    // 1, 2, 3, 0, 1, 2, 3, 0, 1, 2
    

    I hope that makes enough sense. I can’t really figure out from the question what exactly you want… Perhaps something like this?

    UPDATE `mytable` SET `mycounter` = (`mycounter` + 1) % {{the limit}}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have one textfield and one show button.. i want after i have been
I know I can use install-data-hook to do anything I want after my data
After a merge I want to use git mergetool to resolve the issue but
i want after i type 0203-ED in textfield ...two character behind that text can
i want after i have been type 123A0001-123A0100 the result is 100 . Or
everyone..i want after i type 0203-ED in textfield ...two character behind that text can
I have a web form with textbox and button. I want after ENTER key
At my form, I have one control ComboBox. I want after databinding add text
I want after keyup on input change background-color input into class box , but
I've almost got what I want after shredding up some serious Xml--but after looking

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.