$sql = "SELECT count(name) FROM `TABLE` WHERE name='$name' ";
$sth=$conn->prepare($sql);
$totalrows = $sth->fetch(PDO::FETCH_ASSOC);
echo "$totalrows";
This is my code to count the total number of rows using PHP PDO Prepare statement, but $totalrows
echo nothing, it has no value. What is the mistake in this code?