I'm confused about these AND and OR statments. How would I get this to work.
$result = mysql_query("SELECT ref_earn FROM links WHERE ref='$mem_info[2]' AND ref_status='done' OR ref_status='redemption'",$db);
What you've written is ambiguous - SQL probably resolves the ambiguity the opposite way to what you want.
It probably goes
(this AND that) OR t'other
and you want
this AND (that OR t'other)
In other words, you'll need to put () in.
Originally posted by Weedpacket What you've written is ambiguous - SQL probably resolves the ambiguity the opposite way to what you want. It probably goes (this AND that) OR t'other and you want this AND (that OR t'other) In other words, you'll need to put () in.
So you mean like
$result = mysql_query("SELECT ref_earn FROM links WHERE ref='$mem_info[2]' AND (ref_status='done' OR ref_status='redemption')",$db);