Title: WordPress Query Removes &#8216;$&#8217;
Last modified: July 5, 2022

---

# WordPress Query Removes ‘$’

 *  [nathanhkn](https://wordpress.org/support/users/nathanhkn/)
 * (@nathanhkn)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/wordpress-query-removes/)
 * I am trying to get the hashed password from my database to a variable and verify
   it to make sure that the password the user entered is correct. When I get the
   password from the database all the ‘$’ signs are removed. This is what I use 
   to get the password from the database:
 *     ```
       $output = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM profile WHERE Name ='$name';" ) );
       $hashedPass = $output->Password;
       ```
   

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Moderator [threadi](https://wordpress.org/support/users/threadi/)
 * (@threadi)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/wordpress-query-removes/#post-15799957)
 * I suppose it is a separate database table called “profile” that you want to access
   there? This does not belong to WordPress, so I’m just wondering.
 * But I tried to recreate this with the WordPress tables. There it works without
   problems. Example:
 *     ```
       $output = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM wp_users WHERE user_login ='%s';", 'username' ) );
       $hashedPass = $output->user_pass;
       var_dump($hashedPass);exit;
       ```
   
 * **Note:**
    You used the $wpdb->prepare() function incorrectly. You need to use
   a placeholder here and add its value as a parameter. Have a look at my example.
 * In my example the encrypted password comes out from the database including “$”.
   If it doesn’t happen with you, it probably has nothing to do with this code you
   showed but rather with the way you use $hashedPass then.
 *  Thread Starter [nathanhkn](https://wordpress.org/support/users/nathanhkn/)
 * (@nathanhkn)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/wordpress-query-removes/#post-15800336)
 * Thanks, the var dump showed the variable with the dollar signs! Though sadly 
   nothing seemed to change with the functionality. What I’m trying to do, is I 
   have the hashed password in the database and I have the user enter the password
   into a form. Im trying to check if they entered the correct password. To do this
   I am using the password_verify() function, which is built into PHP.
 *     ```
       $output = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM profile WHERE Name = '%s';",$name ) );
       $hashedPass = $output->Password;
       $result = password_verify($password, $hashedPass);
       ```
   
 * For some reason $result never is 1. Unless I am checking for it to be 1 wrongly.
   
   Heres the if statement: `if($result == 1){`
 *  Moderator [threadi](https://wordpress.org/support/users/threadi/)
 * (@threadi)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/wordpress-query-removes/#post-15800939)
 * _password\_verify _will not work for salted hashes. Are these salted hashed passwords?
   I can’t tell since you are using a non-Wordpress database table.
 * Maybe a PHP forum would be better suited for your question as I don’t see any
   connection to Wordress at the moment.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘WordPress Query Removes ‘$’’ is closed to new replies.

## Tags

 * [database](https://wordpress.org/support/topic-tag/database/)
 * [query](https://wordpress.org/support/topic-tag/query/)
 * [WordPress-Database](https://wordpress.org/support/topic-tag/wordpress-database/)

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 3 replies
 * 2 participants
 * Last reply from: [threadi](https://wordpress.org/support/users/threadi/)
 * Last activity: [3 years, 11 months ago](https://wordpress.org/support/topic/wordpress-query-removes/#post-15800939)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
