i dont have php5 so i cant try it since its using mysqli, but the query method returns true or false, so you shouldnt need the & operator there.
either way, the same in php4 using mysql_query works fine for me
$result = mysql_query('select * from mytable') or printf("error has occured"); //no error
$result = mysql_query('select fsdafsdfasd') or printf("error has occured: %s", mysql_error()); //shows error
in any case though, the following also work the way you want
$result = &mysql_query('select * from mytable') or printf("error has occured"); //no error
$result = &mysql_query('select fsdafsdfasd') or printf("error has occured: %s", mysql_error()); //shows error