Title: User variable in WHERE clause
Last modified: October 30, 2017

---

# User variable in WHERE clause

 *  [aryone](https://wordpress.org/support/users/aryone/)
 * (@aryone)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/user-variable-in-where-clause/)
 * I tried to use a variable $seplog_logged_userID in a WHERE clause, like in your
   example SELECT * FROM wp_users WHERE user_login=’#user_login#;’ but can not get
   it working. This is the query: SELECT radio_posi AS posicao, COUNT( * ) contador
   FROM SaveContactForm7_2 WHERE num_ident = ´$seplog_logged_userID;´ GROUP BY posicao
   ORDER BY posicao ASC . I tried with (“, ‘, #) and nothing works.
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fuser-variable-in-where-clause%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 1 replies (of 1 total)

 *  Thread Starter [aryone](https://wordpress.org/support/users/aryone/)
 * (@aryone)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/user-variable-in-where-clause/#post-9653593)
 * In the previous question I did not understand that only the WordPress user could
   be accessed. Now I included the command global $seplog_logged_userID, and changed
   the command $dss_sql_string=str_replace (“#user_login#”, $seplog_logged_userID,
   $dss_sql_string) on these two files: display-stats-getdata-single.php and display-
   stats-chart.php. Now I can access the ID of a logged user, generating charts 
   depending on who is logged on the front end.

Viewing 1 replies (of 1 total)

The topic ‘User variable in WHERE clause’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/display-sql-stats.svg)
 * [Display SQL Stats](https://wordpress.org/plugins/display-sql-stats/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/display-sql-stats/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/display-sql-stats/)
 * [Active Topics](https://wordpress.org/support/plugin/display-sql-stats/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/display-sql-stats/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/display-sql-stats/reviews/)

## Tags

 * [User Login](https://wordpress.org/support/topic-tag/user-login/)

 * 1 reply
 * 1 participant
 * Last reply from: [aryone](https://wordpress.org/support/users/aryone/)
 * Last activity: [8 years, 7 months ago](https://wordpress.org/support/topic/user-variable-in-where-clause/#post-9653593)
 * Status: not resolved