未定义的索引:Project_Name [关闭]

I'm trying to count all my project in project table Project_Name is a column_name

Here is the my code I have tried:

<?php
   $sql = "SELECT COUNT(*) FROM project";
   $result = $connection->query($sql);  
   if ($result->num_rows > 0) {
      $row = $result->fetch_assoc();    
      $project_count = $row['Project_Name'];
   } 
   else {
      echo "0 results"; 
   } 
?>

Try this

$sql = "SELECT COUNT(*) FROM project";
$result = $connection->query($sql); 
if ($result->num_rows > 0) {
    $row =$result->fetch_array();
    $project_count = $row[0];
}

The query is returning only the count. Use another query like: SELECT * FROM project; for fetching the columns values in each row. With this, you will be able to do $row['Project_Name'];