0

The following code doesn't seem to be working correctly, when I put just 1 thing in WHERE it works fine so maybe I cant do multiple items in here?

The code snippet is

$query_view_users = "SELECT id, type, name, username, email FROM admin_users WHERE id, type, name, username, email LIKE '$search'";

Thank you so much for your help. :-)

2 Answers 2

5

it's a multi-condition WHERE clause. use OR or AND which ever satifies your needs.

SELECT ...
FROM ....
WHERE id   LIKE '$search' OR 
      type LIKE '$search' OR 
      name LIKE '$search' OR 
      username LIKE '$search' OR 
      email    LIKE '$search'
Sign up to request clarification or add additional context in comments.

2 Comments

OR or AND? Looks like he meant AND. +1'ed
@janenz00 yeah, i added both. it depends on what he needs :D
0

your sql would have to be

$query_view_users = "SELECT * FROM admin_users WHERE id OR type OR name OR username OR email LIKE '$search'";

Comments

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.