First thing to check: in 'if($$result['id']==1)' the double dollar is intentional.