Hi, I've been having a lot of trouble getting the below code to work, basically, this is going to work in collaboration with a simple maze game that I've made and will be used for loading mazes created by users. At the moment my database only holds 2 rows (with mazeID's of 0 and 1).
I feed in the start and end indexes of which mazes to display on the load screen, this will then fetch all mazes with mazeIDs between those 2 values. However, when I have my $startInd = 0 and $endInd = 14, all I'm getting is 1 result found, which is the one with mazeID = 0.
I can't figure out why but after a whole load of attempts to pinpoint the problem I've discovered that it's coming from "WHERE mazeID BETWEEN "$startInd" AND "$endInd"", specifically the part which compares mazeID to "$endInd". But how is it that 1 <= 14 is not returning true?? Any suggestions?
<?php
$sqlConnect = mysqli_connect([insert secret information here]);
if(mysqli_connect_errno()){
exit("Error. Unable to connect to database.");
}else{
$startInd = $_GET['startInd'];
$endInd = $_GET['endInd'];
$startInd = (integer) $startInd;
$endInd = (integer) $endInd;
$allRecords = mysqli_query($sqlConnect, 'SELECT mazeID FROM maze_saves');
$rowCount = mysqli_num_rows($allRecords);
$selectedRecords = mysqli_query($sqlConnect, 'SELECT mazeID, names FROM maze_saves WHERE mazeID BETWEEN "$startInd" AND "$endInd" ORDER BY mazeID ASC');
}
mysqli_close($sqlConnect);
?>