get_var result empty for query of custom table in plugin admin

There’s error in your query statement. Change to this

$post_id = $wpdb->get_var( "SELECT post_id FROM $customtable WHERE uniquecode="$uniquecode" AND blog_id = '$user_blog_id'" );

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)