Different results by using chi square test and logistic regression I am working on a problem to identify the risk factors to infection after operation. So there are risk factors such as age, pre existing condition, cause of infection etc. Since the dependent variable and most of variables are categorical data, I used logistic regression first, in which the factor A is not significant. 
Just want to double confirm, I used chi square test just between the dependent variable and A, this time the P value is 0.03 which means they are correlated. Can anyone give me a hint? Does this imply the correlation between the factors? 
 A: A few points:
1) The fact that the independent variables are categorical is irrelevant for the choice of logistic regression.
2) A significant chi-square value means the two variables are associated, but if both are categorical, it's not really correlation. If both variables have only 2 levels, there are analogues of correlation.
3) (your main question)  It appears you did a logistic regression with multiple independent variables and compared it to a chi-square test between only two variables (infection and A). These ask two different questions, so they get different answers. The first asks whether A affects the odds of infection after controlling for other variables. The second does not control for any other variables. If all the independent variables were completely unrelated, then I believe the effect sizes (odds ratios) would stay the same. However, this hardly ever happens in real life (except in some very controlled experiments).
4) Just as an aside, it is better to look at effect sizes, not just p values. 
