Note: new to mysql
I am trying to get points from user id ( please view attached table image)
qa_ is my custom table prefix
I am using wordpress and want to get current logged in user id and want to pass it so can get points of that user id.
Here what I am trying but nothing work
function qa_points($userid){
global $wpdb;
$prefix = 'qa_';
$points = $wpdb->get_results("
SELECT *
FROM ${prefix}userpoints
WHERE points = userid
");
return '(points '.$points['points'].')';
}
If you want to select the points from a user, you have to select the correct user: