, fetchAll(). , . , , , , .
, , . , followers? ( , , , ).
, , INSERT. followers (follow_from,follow_to), , , 'Duplicate entry' INSERT. . 'Duplicate entry', , , , .
, :
$stmt = $con->prepare("INSERT
INTO followers (follow_from, follow_to)
VALUES (:ff, :ft)");
$stmt->bindValue(':ff', $follower, PDO::PARAM_STR);
$stmt->bindValue(':ft', $username, PDO::PARAM_STR);
$result = $stmt->execute();
if ($result) {
} else {
if (false == stripos($stmt->errorCode,'Duplicate')){
echo 'Something failed in the insert: ' . '$stmt->errorCode';
}
else {
}
}
Pro tip: SELECT * ; ; , , , , .
Pro tip: , WHERE, COUNT() , . , ?