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 982471
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T04:42:06+00:00 2026-05-16T04:42:06+00:00

I have a problem with mysql query .. I have a table in the

  • 0

I have a problem with mysql query ..

I have a table in the data .. name is (Info_website) , the field is (NumVisitor) ..

the problem when the visitor refresh the page I want the filed (NumVisitor + 1) but infact it +2 ..

this is the code ..

$sql2 = "UPDATE `Info_website` SET `NumVisitor` = `NumVisitor`+1 WHERE `Id`=1 LIMIT 1";
$query = mysqli_query($connect, $sql2) or die (mysqli_error());

thank you very much ..

// New Comment

<?php
require("startsession.php");
require("config.php");
include "../include/header.php";
echo '<title>'.$setting['websit_title'].' - Main Page </title>';
?>
<br />
<br />
<table align="center" width="65%">
<tr>
    <td class="head_title" colspan="4">Information</td>
</tr>
<tr>
    <td width="35%">Number of New Book:</td>
    <td>
        <?php
            $sql = "SELECT IDkalemat FROM main_kalemat";
            $query = mysqli_query ($connect , $sql) or die (mysqli_error());
            $num = mysqli_num_rows($query);
            echo $num;
        ?>      
    </td>

    <td width="35%">Number of Users:</td>
    <td>
        <?php
            $sql = "SELECT IDUser FROM user_kalemat";
            $query = mysqli_query ($connect , $sql) or die (mysqli_error());
            $num = mysqli_num_rows($query);
            echo $num;
        ?>
    </td>
</tr>
        <tr>
        <td width="35%">Number Of Visitors:</td>
    <td>
        <?php
            $sql = "SELECT NumVisitor FROM Info_website";
            $query = mysqli_query ($connect , $sql) or die (mysqli_error());
            $num = mysqli_fetch_array($query);
            echo $num['NumVisitor'];
        ?>
    </td>
</tr>

</table>

<br />
<br />
<?php

//-------- from here the number of visitor

//--------- the end
$sql2 = "UPDATE Info_website SET NumVisitor = NumVisitor+1 WHERE Id=1 LIMIT 1"; 
$query = mysqli_query($connect, $sql2) or die (mysqli_error());
if ($query)
{
    echo '1';
}else{
    echo '0';
}
include ("../include/footer.php");
?>
  • 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-16T04:42:07+00:00Added an answer on May 16, 2026 at 4:42 am

    It sounds like this code is being executed twice on each page visit. Can you show us the rest of the code as well?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a weird problem with my mysql query syntax. I have made a
I have a problem with (for me to complicated) MySql query. Okay, here is
I have a mysql problem, my query looks as follows but not complete SELECT
i have a problem concerning a select query in MYSQL i have two different
I have a problem with MySql.Data in a partial trusted environment. I've added MySql.Data
I wanna know a single MySQL query for solving this problem: I have a
I initially create a table using some data loaded from a php mySQL query.
I have a table in mysql: CREATE TABLE user (id INT, name VARCHAR(250)); I
I have some problem regarding the search in mysql. Below is my query. SELECT
I have a litte problem with a mysql query. I use 5 tables: user_has_data

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.