WordPress Plugins and custom mySQL query conflict

  • Author
  • #1144422



    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]


    <?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 a 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.




    The site you are asking about does not seem to be hosted on WordPress.COM so you need to make friends over at WordPress.ORG the keepers of the software you are using.


    This site is for support of sites hosted on WordPress.COM. You should address your questions to WordPress.ORG the keepers of the software you are using: http://wordpress.org/support/

    For more on the difference: http://support.wordpress.com/com-vs-org/

The topic ‘WordPress Plugins and custom mySQL query conflict’ is closed to new replies.