I’m trying to display three images one after the other, all the image data is stored in a data table.
I have a query that gets the data and then the results array displays the images.
The data table has a column named “DisplayOrder” and each of the three records have a DisplayOrder of “1,2,3”.
$query_fb = "
SELECT
RecordID, SignageName, SignageFromStamp, SignageFromDate, SignageFromTime,
SignageToDateTime, SignageToDate, SignageToTime, SignageFromStamp, DisplayType,
SignageImageName, SignageOnOff, Day1, Day2, Day3, Day4, Day5, Day6, Day7, AllDays,
TimeLapse, FileType, DisplayOrder
FROM Signage
WHERE
BaseID = '".$baseID."' AND
BoardID = '".$DisplayID."' AND
ImageDefault = '0' AND
('".$NowTimeStamp."' BETWEEN SignageFromStamp AND SignageToStamp
AND BaseID = '".$baseID."' AND BoardID = '".$DisplayID."') AND
'".$DayOfWeek."' IN(Day1, Day2, Day3, Day4, Day5, Day6, Day7)
ORDER BY DisplayOrder ASC
";
If I run the above query it returns three records in the correct order,
When I try to echo the results using the code below it displays the record starting at record No 2 instead of Record No 1 as per the query result.
<?php
if (mysqli_num_rows($fb) > 0) {
while ($row = mysqli_fetch_assoc($fb)) {
$FileType = $row['FileType'];
$URLCount = isset($row['DisplayCount']) ? $row['DisplayCount'] + 1 : 1;
// Display the content based on FileType
?>
<div class="banner-container" data-delay-time="<?=$row['TimeLapse']?>">
<a>
<?php if ($FileType == 1) { ?>
<img src="/<?=$ImagePath . $row['SignageImageName']?>" />
<?php } elseif ($FileType == 3) { ?>
<div class="fullscreen">
<iframe id="myvideo" type="video/webm" src="<?=$row['ExternalURL']?>" frameborder="0" allowFullScreen="allowFullScreen"></iframe>
</div>
<?php } else { ?>
<video id="video_player" autoplay muted playsinline>
<source src="/<?=$ImagePath . $row['SignageImageName']?>" />
</video>
<?php } ?>
</a>
</div>
<?php
}
}
?>
Can anyone see where I am going wrong?