$sql = "SELECT test1,'$montreal' AS testX FROM test WHERE test1='$zurich'";
Mark's answer is correct, but not for the reason he gives.
He says that the above will treat '$montreal'
as a string literal. Normally that is correct, but because it's embedded in a double quoted string, it will actually be interpolated correctly.
What's actually happening is that you're generating a string along the lines of:
SELECT test1,'fieldname' AS testX FROM test WHERE test1='$zurich'
The 'fieldname'
is incorrect - it's a column name. Single quotes in an SQL query are for values, so MySQL isn't interpreting this as you expect. If you want to use quotes for a column (or table) name, you need to use backticks:
$sql = "SELECT test1,`$montreal` AS testX FROM test WHERE test1='$zurich'";
Will work. Though as you noticed, you can get the same effect by omitting any quotes.