I get the following error while fixing my wordpress plugin standards.
Use placeholders and $wpdb->prepare(); found $sql
Below is my code...
public function get_db_value() {
//getting meta_value from wp_usermeta
global $wpdb;
$billing_phone = isset($_POST['billing_phone']);
$sql = "
SELECT user_id,meta_key, meta_value
FROM {$wpdb->usermeta}
WHERE ({$wpdb->usermeta}.meta_key = 'billing_phone'";
$ansatte = $wpdb->prepare($wpdb->get_results( $sql ));
$users = array();
foreach ( $ansatte as $a ) {
$users[ $a->user_id ][ $a->meta_key ] = $a->meta_value;
}
foreach ( $users as $u ) {
$nums[] = $u['billing_phone']; //Saving phone numbers in $nums variable
}
return $nums;
}