You'd be better off using the "IN" operator. It's a shorter, faster way of doing the OR something=something multiple times. Try this.
$statesarray = array("AZ","CA","OR","MO","NY","IL");
/* SQL construction */
$sql = "SELECT *
FROM table
WHERE states IN (";
/* Now loop through the array, and add them to the SQL */
for($i=0;$i<count($statesarray);$i++) {
if($i == 0) { //no comma on the first one
$sql .= "'".$statesarray[$i]."'";
}
else {
$sql .= ", '".$statesarray[$i]."'";
}
}
/* Now close the IN statement */
$sql .= ")";
mysql_query($sql);
HTH