Why does this WPDB code throw an empty WPDB error? [closed]

The code you’ve linked to above:

    //$sql set to raw SQL statement
    $sql = $wpdb->prepare($sql,$feed_id);

    if($wpdb->query($sql)){
      $resp->uf_error = $wpdb->print_error();
    }

So if there isn’t, an error you try displaying the ‘error’ with $wpdb->print_error(). Also$wpdb->print_error() doesn’t return an error, it prints it.

It’s (probably) the printing of that non-error that is causing an error in your second database query, the one for which an error is logged.

Side note: take a look at the wpdb class. There are methods in there that handle INSERT/UPDATE queries so you don’t have to do them manually.