• I am working on utility that imports posts from Joomla to WordPress. The code is kept in a sub-folder inside the WP root. The PHP has the following code, but I get the following error when I run it:

    Code:

    require_once('../wp-config.php');
    require('../wp-blog-header.php');
    require_once ('../wp-includes/functions.php');
    
    $my_post = array();
    $my_post['post_title'] = 'title';
    $my_post['post_content'] = 'content';
    $my_post['post_status'] = 'publish';
    $my_post['post_author'] = $ID;
    $my_post['post_date'] = '<date>';
    $my_post['post_category'] = array($wpsection);
    $my_post['post_name'] = $post_name;
    $my_post['post_excerpt'] = 'excerpt text';
    
    // Insert the post into the database
    $post_id = wp_insert_post( $my_post );

    Error:

    Warning: mysql_error(): 9 is not a valid MySQL-Link resource in C:\xampplite\htdocs\wp27nirantar\wp-includes\wp-db.php on line 685
    Warning: mysql_error(): 9 is not a valid MySQL-Link resource in C:\xampplite\htdocs\wp27nirantar\wp-includes\wp-db.php on line 685
    Warning: mysql_affected_rows(): 9 is not a valid MySQL-Link resource in C:\xampplite\htdocs\wp27nirantar\wp-includes\wp-db.php on line 691
    Warning: mysql_insert_id(): 9 is not a valid MySQL-Link resource in C:\xampplite\htdocs\wp27nirantar\wp-includes\wp-db.php on line 694

Viewing 11 replies - 1 through 11 (of 11 total)
Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Not a valid MySQL-Link resource in wp-db.php’ is closed to new replies.