I have two Tables
1: USERS
user_id |
user_state |
user_email
2: CONTACTS
contact_id |
contact_name |
contact_state |
contact_email |
contact_info
What I want to do is for the select to echo all "CONTACTS" data where the "user_state" (which is the logged in users state) is equal to contact_state.
"SELECT * FROM contacts
INNER JOIN users
ON contact_state = ".$row_userinfo['user_state']."
WHERE contact_state = ".$row_userinfo["user_state"]."
ORDER BY contact_name $limit");
?>
What I'm having trouble with is its not only showing the data that matches the logged in users state (user_state)
and with the above code (which I'm not to sure if it is correct to work the way I want) is coming up with "Unknown column '...' in 'where clause'"
Hopefully someone can help me.