Before you link "this is similar to this" or send me to another question, Please read.
I am having a problem with one function/Select statement. The $wpdp->get_results
simply will not run no matter what I do.
function view_client () {
global $wpdb;
if(isset($_POST['post_personid'])) {
$id = $_POST['post_personid'];
$stmt = $wpdb->get_results("SELECT * FROM {$wpdb->prefix}acl_client_info");
print_r($stmt);
$wpdb->show_errors();
$wpdb->print_error();
/*foreach($stmt as $results){
$firstName = $results->first_name;
echo $firstName;
}*/
}
wp_die();
}
add_action('wp_ajax_viewclient','view_client');
add_action('wp_ajax_nopriv_viewclient','view_client');
This function is on my main plugin file along with plenty of other functions that use the same $wpdb->get_results
method to pull results and THEY WORK!!
I have tried multiple solutions($wpdb->prepare
, $wpdb->query
) from other post but nothing is working. I am getting no errors no warning, nothing. As you can see the select statement is not even the full statement I need. After taking alot of variables out and just trying Select * from table
, it still wont work.
If I echo out the $id
, it works so I know the Ajax shouldn't be the problem. And the table name is correct. I even tried a different table and it wont work. I am not really doing anything different from my other functions so I just dont get why this is working.
Please someone out there help me. I'm loosing my mind.
Thank you!