WordPress.org

Forums

[resolved] WordPress Plugins and custom mySQL query conflict (2 posts)

  1. pp_1
    Member
    Posted 2 years ago #

    Hi,

    What's wrong: When I use mySQL custom query on one of pages AND I have some plugins I experience a conflict.

    My custom query works well, but plugins show errors (Can't connect to gallery, can't find gallery etc.) or don't show up at all.
    Custom query OR plugin -> everything's just fine.

    An example of code:

    $username= "wordpress_user";
    $password = "wordpress";
    $hostname= "localhost";
    
    $dbhandle1 = mysql_connect($hostname, $username, $password)
    or die("Unable to connect to MySQL");
    
    $selected = mysql_select_db("denco_1",$dbhandle1)
    or die("Could not select examples");
    
    $result = mysql_query("SELECT szkolenia.temat, wykladowcy.nazwa, wykladowcy.oznaczenie, wykladowcy.id AS wykladowca_id, szkolenia.specjalnosc, szkolenia.id, szkolenia.pokaz FROM szkolenia LEFT JOIN wykladowcy ON szkolenia.prowadzenie = wykladowcy.oznaczenie WHERE szkolenia.pokaz = 'tak'");
    
    if(mysql_num_rows($result) > 0) {
    while($row = mysql_fetch_object($result)) {
    echo "$row->specjalnosc"; }

    Plugin code examples:

    [nggallery id=1]

    or

    <?php do_action('slideshow_deploy', '74'); ?>

    Doesn't matter if plugin (or widget) is in the same column with query or in the sidebar / footer. It seems that plugins that need an sql connection don't work when I use it...

    What I've already tried:
    -Wordpress update (twice, two last versions) -no difference;
    -My theme (Atahualpa) update -no difference;
    -Switch theme to Twenty Ten and Eleven - no difference;
    -rename $username, $password, $hostname and $dbhandle variables -no difference;
    -change php handling plugin (3 different)- no difference;
    -import tables I need to wordpress database -no difference;
    -import tables I need to wordpress database AND change
    $result = mysql_query("Select...");
    to
    $result = $wpdb->get _results("Select...)-no difference
    -add and remove
    mysql_close(); -no difference;

    I'm out of ideas, I'd appreciate your help very much.

  2. pp_1
    Member
    Posted 2 years ago #

    [Solved] Downgrading PHP (5.4->5.2) solved the issue.

Topic Closed

This topic has been closed to new replies.

About this Topic