$query = "SELECT * FROM tablename WHERE columnname = '$var1' AND columnname = '$var2'";
you cant put variables in single quotes, only double quotes but you can use single quotes for the DBMS. So i just swapped them over
IE;
$msg = "World!";
echo "Hello $msg";
// OK, outputs "Hello World!"
echo 'Hello $msg';
// Not OK, outputs 'Hello $msg'
The best way to spot errors like this is to output the SQL query to check that it looks OK. Just make sure you don't on a live website 😉