I have my code working well on localhost, but when loaded on the remove server it behaves differently - the id on localhost shows as it should (see image) - id is in order.
However, on the remote server it is not, yet the code is identical!!
I have tried running just the sql query in myphpadmin on the remote server and it is fine.
$con = mysqli_connect("localhost", "******", "******", "ps10");
if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: ".mysqli_connect_error();
}
if ($_POST['selClass'] == 'All records' OR $_SESSION['selClass'] == 'All records') {
$query_rs4 = "SELECT *
FROM marker
INNER JOIN users ON marker.class = users.class";
} else {
if (empty($_POST['selClass']) && empty($_SESSION['selClass'])) {
$query_rs4 = "SELECT *
FROM marker
INNER JOIN users ON marker.class = users.class";
} else {
$query_rs4 = "SELECT *
FROM marker
INNER JOIN users ON marker.class = users.class
WHERE users.username='{$_SESSION['selClass']}'";
}
}
$rs4 = mysqli_query($con, $query_rs4) or die(mysqli_error($con));
$row = mysqli_num_rows($rs4);
echo "There are ".$row." students in this class";