I have tried everything I can find to try and get time formatted results from my table using mysql_fetch_array while also getting other results.
This is my code:
<?php
$con = new mysqli("mysql.hostinger.co.uk", "user", "password", "database");
$con->set_charset('utf8mb4');
//Retrieve all the data from the Update Log Table
$result = $con->query("SELECT requestID, songTitle, artistName, requester, dedicatedTo, TIME_FORMAT(requestTime, '%r'), dance FROM `table` ORDER BY requestID DESC") or die(mysql_error());
echo "<form class='formleft'>";
//keeps getting the next row until there are no more to get
while($row = mysqli_fetch_array($result)){
//Print out the contents of each row into a table
echo "<div class='reqgap'></div>";
echo "<input type='checkbox' id='play";
echo $row['requestID'];
echo "' class='play checkbox' autocomplete='off' ";
if ($row['requestID'] == '0') {
echo "style='display:none;' />";
} else {
echo "/>";
};
echo "<label class='played' for='play";
echo $row['requestID'];
echo "' ";
if ($row['requestID'] == '0') {
echo "hidden >";
} else {
echo ">";
};
echo "Played";
echo "</label>";
echo "<article class='request songs req";
echo $row['requestID'];
if ($row['requestID'] % 2 == 0) {
echo " even";
} else {
echo " odd";
};
echo "' >";
echo "<article class='requestleft'>";
echo "<article class='requestnum'>";
echo "<p class='requestnumt'>";
if ($row['requestID'] == '') {
echo "RequestID Error";
} else {
echo $row['requestID'];
}
echo "</p>";
echo"</article>";
echo "<article class='requesttime'>";
echo "<p class='requesttimet'>";
if ($row['requestTime'] == '') {
echo "Request Time Error";
} else {
echo $row['requestTime'];
}
echo " UTC</p>";
echo"</article>";
It just shows my error message "Request Time Error" when it comes to displaying that data. Any assistance will be greatly appreciated