Please am learning php OOP and am running into this errors How can i fix this? Here is my code below:
<?php
class songs_data {
private $conn;
public int $limit;
public function __construct()
{
 global $conn;
 $this->conn = $conn;
}
public function get_songs($limit){
  $sql = "SELECT * FROM songs WHERE published= true ORDER BY id DESC LIMIT ?"; // 
  SQL with parameters
  $stmt = $this->conn->prepare($sql);
  $stmt->bind_param("i", $limit);
  $stmt->execute();
  $songs = $stmt->get_songs($limit); // get the mysqli result
  // fetch data
  return $songs->fetch_assoc();
 }
}
And Here is my index.php code below:
 <?php 
     $song = new songs_data();
        $songs = $song->get_songs(5);
        foreach ($songs as $row) {
            echo $row["song_name"];
        }
  ?>
