Code doesnt work when it is uploaded

`

<?php require('load/header.php'); ?>
<?php session_start(); require("actions/connection.php"); $id = $_SESSION['login_user']; $sql = "SELECT * FROM enrolledcourses WHERE IDNumber = '$id'"; $result = mysqli_query($dbc,$sql); while($row = mysqli_fetch_assoc($result)){ $Course = $row['Course']; $image = $dbc->query("SELECT Image from Course WHERE Title ='$Course'")->fetch_row()[0]; $Description = $dbc->query("SELECT Description from Course WHERE Title ='$row[Course]'")->fetch_row()[0]; $image = "Images/course_images/$image"; $count = 0; echo "
$Course
"; $count++; } ?>

`

Everything under the while loop doesnt echo back. I tried echoing the $sql and copy and pasting it in phpmyadmin and it returned the results just fine and it is definitely working on my localhost. I dont know whats wrong with it

Could you please reformat the code to make it easier to read? By adding a line with three backticks above and below the code you’ll get a nice, colored block of source code. If you could then make sure it contains proper line endings it becomes easy to see what the code is doing.

<?php require('load/header.php'); ?>

<?php 
session_start(); 
require("actions/connection.php"); 
$id = $_SESSION['login_user']; 
$sql = "SELECT * FROM enrolledcourses WHERE IDNumber = '$id'"; 
$result = mysqli_query($dbc,$sql); 
while($row = mysqli_fetch_assoc($result)){ 
$Course = $row['Course']; 
$image = $dbc->query("SELECT Image from Course WHERE Title ='$Course'")->fetch_row()[0]; 
$Description = $dbc->query("SELECT Description from Course WHERE Title ='$row[Course]'")->fetch_row()[0];
 $image = "Images/course_images/$image"; 
$count = 0; 
echo "image $Course";
 $count++; 
} 
?>
$('.courselink').click(function(){
 var id = $(this).attr("id"); window.location.assign("<?php echo "Course.php?subject=" ?>" + id); 
})

There ya go @Admin

I don’t see anything immediately wrong with the script (although the mix of procedural and object oriented queries is a bit confusing).

The best thing I can recommend here is to just start debugging it yourself. Does the script crash during the loop? Does the loop not execute because no items are found? var_dump() and die() allow you to look at what a variable holds where.