I have a table in MY SQL that may either have an entry in a certain column as 1 or > than 1. Basically based on the current Value of the Entry in the column I would wish to run either of two methods:
Part code:
$db->prepare("SELECT vote_count FROM tbl_voter_count WHERE voter_phone_number = :phone ");
$sql->bindParam(":phone", $phone );
try {
$sql->execute();
} catch(PDOException $e) {
echo $e->getMessage();
}
$data = $sql->fetchAll(PDO::FETCH_ASSOC);
if($data){
foreach ($data as $row) {
$count = $row['vote_count'];
if($count == 1)
{
//Logic 1
}
//Logic 2
}
Based on the above,is there a better way of aciving this with far much less code entanglement and Lines.?