query($sql); if ($result && $result->num_rows > 0) { // Loop through the database rows and push names into the array while ($row = $result->fetch_assoc()) { $projects[] = $row; } } return $projects; } function getThreeProjects($mysqli){ $sql = "SELECT * FROM projects ORDER BY id DESC LIMIT 3"; $result = $mysqli->query($sql); if ($result && $result->num_rows > 0) { // Loop through the database rows and push names into the array while ($row = $result->fetch_assoc()) { $projects[] = $row; } } return $projects; } ?>