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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T04:08:23+00:00 2026-06-14T04:08:23+00:00

I have a weird problem in mysql with php I am running this query

  • 0

I have a weird problem in mysql with php

I am running this query with PHP’s mysql_query function.

Assume that view_counter = 30

UPDATE cini_gallery_data SET view_counter = view_counter+1 WHERE id = '10'

After this query

view_counter is 32 or sometimes 33 instead of 31

I have checked for duplicate queries also.

Whats wrong with this? It’s so weird.

EDIT: php code i have used.

if(!mysql_query("UPDATE cini_gallery_data SET view_counter = view_counter+1 WHERE id='10'")){
    die(mysql_error());
}
  • 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-06-14T04:08:25+00:00Added an answer on June 14, 2026 at 4:08 am

    As you edited your question, and you said that you are not able to increment the counter, I guess you’ve set your id field or view_counter on AUTO INCREMENT

    Previous Answer :

    This is wrong

    WHERE = '10'
    

    You forgot to add column name in your WHERE clause, It should be

    WHERE column_name = '10'
    
    • 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 this weird problem with setting up cookies with PHP. Everything worked fine
I'm running into a really, really, really weird problem with mysql. I have a
I have this really weird problem with my MySQL table. After some time a
I have this weird problem when trying to INSERT a row into my mysql
So I have this problem when I run a script with PHP PDO that
I have a weird problem with a MySQL query... It's weird because it does
I'm working with the Head First PHP/MySql book, and have a weird problem with
I have this weird problem in java when trying to fetch records from MYSql
I have a weird problem. When I execute a query the data is not

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.