My question is fairly simple. I have a column in my table labeled 'area' that appears like:
ma_south-coast
ma_south-caost
ma_north
ca_los-angelos
ca_los-angelos
I want to be able to select just the 'ma' ones. I am trying to do something such as:
$res_area = mysqli_query($connection,"select area from users");
while ($row_state = mysqli_fetch_array($res_area)) {
$state_exp = reset(explode("_", $row_state['area']));
}
Printing $state_exp at this point would give me: mamamacaca which is good. But I want to filter so I only get the ma ones.