WordPress.org

Ready to get started?Download WordPress

Forums

use stored procedure in WordPress (4 posts)

  1. CommonEasy
    Member
    Posted 3 months ago #

    Hi there,
    I really would like to perform a stored procedure in MySQL which updates the wp_bp_xprofile_data table with information from a view in MySQL. The procedure should be started when somebody updates his profile. This is the code I use in bp-custom.php.

    function something_updated_profile() {
    
      $wpdb->query("CALL dekking_ophalen( )");
    
      }
    add_action('xprofile_updated_profile', 'something_updated_profile');

    However, when I update my profile I only see a white page ( I have debugger enabled). After doing some research on the buddypress forums I am pretty sure that the error I make is in the $wpdb->query("CALL dekking_ophalen( )"); line. I use wordpress 3.9.1 & bp 2.0.1. The stored procedure is stated as:

    INSERT INTO wp_bp_xprofile_data
    ( field_id,  user_id, value )
    
    SELECT 15, User,  dekking_absoluut
    FROM  dekking
    
    On duplicate KEY UPDATE
    wp_bp_xprofile_data.value=(SELECT dekking.dekking_absoluut
      FROM dekking
      WHERE dekking.user=wp_bp_xprofile_data.user_id )

    This stored procedure doesn't need to give any results, it just have to perform an update on a table. What point am I missing here?

  2. Craig Ralston
    Member
    Posted 3 months ago #

    Have you checked your servers error logs?

  3. CommonEasy
    Member
    Posted 3 months ago #

    Hi craig,
    Thanks for your question...i'm not really sure what you mean, but i looked at the c-panel of my hosting provider en there where no logs to be found (all where empty). i also added

    // Enable WP_DEBUG mode
    define('WP_DEBUG', true);
    
    // Enable Debug logging to the /wp-content/debug.log file
    define('WP_DEBUG_LOG', true);
    
    // Disable display of errors and warnings
    define('WP_DEBUG_DISPLAY', false);
    @ini_set('display_errors',0);

    to my config file and tried the code a couple of times, but i didn't find the debug.log file. any idea of what i am doing wrong? Thanks!

  4. Craig Ralston
    Member
    Posted 3 months ago #

    Please take a look at the Codex to see how you should prepare your statement.

Reply

You must log in to post.

About this Topic