• Resolved Robert W. Drummond

    (@rwdrummondcoxnet)


    I have some code that increments a database field:

    $result = $wpdb->query( "UPDATE test SET counter = (counter + 1) WHERE id = 1" );

    Oddly, if WPPA+ is activated, the above statement increments counter by 2! If I change it to (counter + 3) it increments counter by 6!

    This code also increments counter by 2 if WPPA+ is active:

    $row = $wpdb->get_row("SELECT * FROM bvweb_test WHERE id=1");
    $mycount = $row->counter + 1;
    $status = $wpdb->update("bvweb_test", array("counter" => $mycount), array( "id" => 1));

    If I deactivate WPPA+ both examples work as expected. At first I thought it was a WP issue, so I tried the mysqli functions instead of $wpdb. Same results. Checked my theme and other plugins – WPPA+ is the only one that causes this behavior.

    Any thoughts/suggestions? Unfortunately this is a development site without public access, so I can’t share a link to it.

    https://www.ads-software.com/plugins/wp-photo-album-plus/

Viewing 6 replies - 16 through 21 (of 21 total)
  • Plugin Author Jacob N. Breetvelt

    (@opajaap)

    Because switching wppa on/off makes a difference, one would expect that wppa has any influence herein, or some other software decides to do something twice, but i find that not really likely.
    I will go on doing some testing with other themes.

    Thread Starter Robert W. Drummond

    (@rwdrummondcoxnet)

    I will also test with some other themes and post the results in a day or two. Thank you!

    Thread Starter Robert W. Drummond

    (@rwdrummondcoxnet)

    It appears that as of version 6.4.15 this is fixed! Your Opajaaptest code is now performing as expected. I have some further testing to do before confirming this is resolved, but this is very promising.

    Just curious – is this a happy coincidence, or did you find something in your testing?

    Plugin Author Jacob N. Breetvelt

    (@opajaap)

    There was a fix in 6.4.12 ( May 14 ) of wich i hoped that would solve your problem.

    It was a silly programming error, found by a very smart user. It was in javascript, where i was testing if ajax was possible, but i did not test on the existance of a function only, but i executed the function accidently, causing a redundant ajax call on every new pageload when ajax was configured.

    I thanked the guy ‘on my bare knees’ that he found this behaviour, of wich i noteced already for years ( the aparently redundant pageloads ) but could not get my finger behind.

    You make my day good, telling me it indeed fixes your issue. It is also an important overall performance improvement btw.

    Thanx for telling me.

    Thread Starter Robert W. Drummond

    (@rwdrummondcoxnet)

    Great news! I’m happy to hear that you were able to resolve it, and I, too, am thankful to the user who helped identify the source.

    Now that this is behind us, it’s time for me to get serious about learning the plugin in depth so I can deploy it on my site.

    Thanks again for helping out on this.

    Plugin Author Jacob N. Breetvelt

    (@opajaap)

    In case of any issue or question, don’t hesitate to ask me.

Viewing 6 replies - 16 through 21 (of 21 total)
  • The topic ‘Unexpected database behavior’ is closed to new replies.