Wordpress unknown database error with select

Wednesday, November 4, 2015

This is code from child functions.php:



function f_goscie(){
global $wpdb;
$kateg = $wpdb->get_results( 'SELECT * FROM kategorie');
}

add_shortcode('goscie','f_goscie');


And this is code from my plugin:



function dominik_play(){
global $wpdb;
define( 'DIEONDBERROR', true ); //i have multisite on
$wpdb->show_errors();

$kateg = $wpdb->get_results( 'SELECT * FROM kategorie');
$wpdb->print_error();
}

add_shortcode('ytplejer','dominik_play');


The first code works without any problems. It's part of bigger code which gets data from my own tables
http://niezaleznylublin.pl/nasi-goscie/



The second code throws this error:




Wordpress database error: [] SELECT * FROM kategorie




niezaleznylublin.pl/player



I dont have ANY ideas why those two very similar functions give different results and one is error.

0 comments:

Post a Comment