Can anyone tell me what's going on here. I'm not sure why this code is not working and throwing the following error:
You have an error in your SQL syntax, check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND role != 7 AND role != 4' at line 3
$sql = 'SELECT * FROM tblusers
INNER JOIN permissions on tblusers.usrID = permissions.user_id
WHERE permissions.team_id='.$team_id.' AND role != 7 AND role != 4';
require("connection.php");
$result = mysql_db_query($DBname,$sql,$link) or die(mysql_error());
while($row = mysql_fetch_assoc($result))
{
$message->addTo($row['usrEmail'], $row['usrFirst'] . ' ' . $row['usrLast']);
}
I know that the variable $team_id is working fine, because if I "echo" it, it works fine. Any ideas on what I'm doing wrong here? Thanks!