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

  • Home
  • SEARCH
  • 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 6823811
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:49:40+00:00 2026-05-26T21:49:40+00:00

I have one webpage (lets call it A.html). A.html has some javascript which switches

  • 0

I have one webpage (lets call it A.html). A.html has some javascript which switches the page to a dynamic php page (lets call it B.php), using a simple document.location=”B.php”. B.php runs a mysql query based on the cookies it sees, and returns a result based on the mysqli->affected_rows variable. However, everytime the page switches over mysqli->affected_rows is equal to 0, even though the mysql table does get changed the way it’s supposed to. Interestingly, when I go straight to B.php using the url bar (or refresh the page) then mysqli->affected_rows is 1, like it’s supposed to be.

Looking at wireshark, the only difference between the two GET requests is that the second (non-javascript) one has a line with Cache-Control: max-age=0. Does anyone know why this would affect anything, and if there’s a way I can fix this?

EDIT: Heres’ the code

    $req = $mysqli->prepare('update users set sts=NOW() where i=? and sid=? and sip=? and NOW()-sts <= '.$authentication_timeout.';');
    if ($mysqli->error) {
        log_mysql_error($mysqli);
        die('Unexpected error:'.$mysqli->error);
    }
    $req->bind_param('sss',$uid,$sid,$_SERVER['REMOTE_ADDR']);
    $req->execute();

    print $mysqli->affected_rows;
    $req->close();
  • 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-26T21:49:41+00:00Added an answer on May 26, 2026 at 9:49 pm

    Wasn’t an issue with the cache at all. The problem arises because in this particular case the same row is being updated just before this code is executed, and there isn’t enough time delay for NOW() to be different. So while the row matches, there isn’t a change in the data so $mysqli->affected_rows is still equal to zero. $mysqli->info shows that “Rows matched: 1, Rows changed: 0”.

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

Sidebar

Related Questions

Here's the situation I have a webpage which has one drop down called prefer.
1) This issue involves just one html webpage, lets call it ajax.html. 2) I
I have got a page which lets me control some devices in a local
I have a Coda slider on one webpage (hand-crafted, not using the plugin, but
If a web page needs some data, why not just have a SQLDataSource call
Heres a tricky one . . I have a webpage (called PageA) that has
I have a web page with 3 forms on it. Not nested, just one
I have one field that I need to sum lets say named items However
I have one std::list<> container and these threads: One writer thread which adds elements
I am making an auction website, which has an auto-bid system. This system lets

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.