Why is this working...
$animal='';
$animal .= "You edited this animal: ";
if ($data['horse'] != $horse){
$animal .= 'Name from "'.$data['horse'].'" into "'.$horse.'"';
}
$sql = "INSERT INTO animal (animal,id) values(?,?)";
$q = $pdo->prepare($sql);
$q->execute(array($animal,$id));
(Result: "You edited this animal: Mustang into Marwari")
...but this...
$animal='';
$animal .= "You edited this animal: ";
function animal_func($label, $orig, $edit) {
if ($orig != $edit){
$animal .= $label.' from "'.$orig.'" into "'.$edit.'"';
}
}
animal_func("Name",$data['horse'],$horse);
$sql = "INSERT INTO animal (animal,id) values(?,?)";
$q = $pdo->prepare($sql);
$q->execute(array($animal,$id));
(Result: "You edited this animal: ")
... is not working