• I have the following code:

    echo “$this->zipcode $key Calling Update”;
    $wpdb>show_errors();
    $wpdb->update(‘ncrj_donors’, array(‘zipcode=>$this->zipcode’), array(‘donorkey=>$key’)) or die(“Update Failed”);
    echo “Update called”;

    When it’s executed this is what I get on the screen:

    02119-1582 Chatelle*******Robert****02119 Calling Update

    The second echo statement is never executed. So the code doesn’t return from $wpdb->update

    There is nothing at all in the php error file.

    I’m baffled.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Perhaps $wpdb>show_errors(); should be $wpdb->show_errors(); ?

    Thread Starter bobchatelle

    (@bobchatelle)

    I put the show_errors in there only for convenience. I look at the actual php error log and it has nothing in it.

    But you’re right there is a typo. Which should have, I think, resulted in a parse error.

    Thread Starter bobchatelle

    (@bobchatelle)

    I corrected the typo, ran again, and got identical results. I’ve tried the code using both php 5.4 and php 5.6.

    The requested update, by the way, does not occur.

    The mystery is why is there no return from the call and why do no errors show up on the log.

    Is this the entire code?

    echo "$this->zipcode $key Calling Update";
    $wpdb>show_errors();
    $wpdb->update('ncrj_donors', array('zipcode=>$this->zipcode'), array('donorkey=>$key')) or die("Update Failed");
    echo "Update called";

    And, are you running this on-line or on your on computer?

    Thread Starter bobchatelle

    (@bobchatelle)

    My apologies for not getting back to this query. I had meant to, but ended up fighting other fires.

    Stupid mistake on my part. This code is part of a php routine that is outside of wordpress. Thus $wpdb is meaningless.

    Perhaps not… Using wpdb, the WordPress database, outside of WordPress and [resolved] Using $wpdb outside wordpress (19 posts).
    Also Google “wordpress using $wpdb outside of”

    Thread Starter bobchatelle

    (@bobchatelle)

    Thanks for the link! I will check it out.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘$wpdb->update problem’ is closed to new replies.