0

I am displaying a list of names on a page in wordpress. And from that list of names, a user can click the name on the 'list of names' on the page. Then it will redirect to a modal. So I have now a specific name being clicked. And from that, I will display another details (like projects involve by this specific person) from another table on this specific user.

Since I have now a specific user, on my query on the modal , the condition there is the javascript variable that i passed on the modal . my question is:

How to convert a javascript variable to be compared in a query?

here is my actual query:

SELECT * FROM xyz77_projects WHERE wp_teams_team_id IN (SELECT team_id FROM xyz77_teams WHERE wp_employee_emp_id = _______ )

the blank there is the specific id of the name that is being clicked.

6
  • 4
    Are you using ajax or is your query on your page with everything else? Commented May 8, 2017 at 7:37
  • Please refer this question, stackoverflow.com/questions/21620133/… Commented May 8, 2017 at 7:40
  • @Icewine , I am not using ajax ma'am.. :( so my query is on my code itself. Commented May 8, 2017 at 7:51
  • 1
    I see only two ways to go here, 1) you use an ajax call and update the content of your page with the resulting data, 2) you create a hidden form in your page, take the value you want and pass it into that form with javascript and submit the form with javascript. That will create a page reload (not the best UX behavior). Commented May 8, 2017 at 7:57
  • @StavrosAngelis yah. I am actually doing it. From the page, pass the value using javascript to the modal. anyways. thank you for the help :D I appreciate it a lot. Commented May 9, 2017 at 1:27

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.