as they are supposed to print the data inside from variables. Don't wrap the print_r or var_dump or print or echo inside an variable. Print 'hello works because it is a string, and $check_last_conversation is an array. Go into wp-config.php file and search for : define('WP_DEBUG',false) and change it to define('WP_DEBUG',true) Įven if your query is okay, you will still result to an error, which you will be getting due to incorrect printing of an array:įunction get_results of $wpdb, is an function that will return an array as result of multi rows, and for dumping it use : print_r($check_last_conversation) So better to be aware or errors and turn the error reporting on to see the errors and when in production do disable the error reporting. It takes me to the conclusion that my file.php doesn't recognise wordpress hooks and could happen for $wpdb too, throughout my query.ĭuring the development always turn on the error reporting to be aware of warnings notice or fatal errors which can occur very easily if you forget something or miss place something. In my case, Wordpress didn't report it in wp-content/debug.log. I could check it trough the server php error log. PHP Fatal error: Call to undefined function get_bloginfo() I've discovered that there is a fatal error in the same file of my query: My debug.log file (wp-content) is not showing any error in my code. My tables are empty at now but should they print nothing than produce that error.My apache_error.log and mysql_error_log.err don't report anything.$ss = "select * from ".$wpdb->prefix."vp_pms_messages inner join ".$wpdb->prefix."vp_pms_group_users on ".$wpdb->prefix."vp_pms_messages.id = ".$wpdb->prefix."vp_pms_group_ssage_id and ".$wpdb->prefix."vp_pms_oup_id = ".$wpdb->prefix."vp_pms_group_oup_id where ".$wpdb->prefix."vp_pms_group_om_username = '$session_uid' and ".$wpdb->prefix."vp_pms_group_om_del = '0' or ".$wpdb->prefix."vp_pms_group_users.to_username = '$session_uid' and ".$wpdb->prefix."vp_pms_group_users.to_del = '0' group by ".$wpdb->prefix."vp_pms_oup_id"
So I suppose there is some problems on how I've written my query. $check_last_conversation = $wpdb->get_results($ss) $ss = "select * from ".$wpdb->prefix."vp_pms_messages inner join ".$wpdb->prefix."vp_pms_group_users on ".$wpdb->prefix."vp_pms_messages.id = ".$wpdb->prefix."vp_pms_group_ssage_id and ".$wpdb->prefix."vp_pms_oup_id = ".$wpdb->prefix."vp_pms_group_oup_id where ".$wpdb->prefix."vp_pms_group_om_username = '$session_uid' and ".$wpdb->prefix."vp_pms_group_om_del = '0' or ".$wpdb->prefix."vp_pms_group_users.to_username = '$session_uid' and ".$wpdb->prefix."vp_pms_group_users.to_del = '0' group by ".$wpdb->prefix."vp_pms_oup_id" I'm probably missing or misunderstanding something but if I comment out $check_last_conversation and I print something like "Hello", the error goes away.
$response = print $check_last_conversation $check_last_conversation = $wpdb->get_results($ss) $the_data = isset($_POST) ? trim(strip_tags($_POST)) : "" $session_uid = isset($_POST) ? trim(strip_tags($_POST)) : ""
I'm using Wordpress and I'm performing a query which gives me back this error:įailed to load resource: the server responded with a status of 500