This is my display page that works
<?php
$conn = mysqli_connect("localhost", "root", "", "china");
$results = mysqli_query($conn, "SELECT * FROM image");
$image = mysqli_fetch_all($results, MYSQLI_ASSOC);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="css/basic.css" rel="stylesheet" type="text/css" />
<link href="css/img.css" rel="stylesheet" type="text/css" />
</head>
<table class="show" width="90%" border="0" cellspacing="5" cellpadding="5">
<tbody>
<?php foreach ($image as $user): ?>
<tr>
<td width="14%" align="left" valign="top"><p class ="dates">Uploaded</p><p class ="date"><?php echo $user['date']; ?></p></td>
<td width="33%" rowspan="3" valign="top" class="this"><img class="b" src="<?php echo 'uploads/' . $user['image'] ?>" width="500" height="250" ></td>
<td width="53%" rowspan="3" valign="top" class="this"><br /><p class="quote"><?php echo $user['comment']; ?> </p></td>
</tr>
<tr>
<td align="left" valign="top"><p class ="dates">From:</p><p class ="date"><?php echo $user['pname']; ?></p></td>
</tr>
<tr>
<td align="left" valign="top" class="this" ><p class="dates">Title</p><p class="date"><?php echo $user['fname']; ?></p></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</body>
</html>
The date is stored as 'current_timestamp()'
It displays as '2021-03-23'
However when I change this section
<?php
$conn = mysqli_connect("localhost", "root", "", "china");
$results = mysqli_query($conn, "SELECT * FROM image");
$image = mysqli_fetch_all($results, MYSQLI_ASSOC);
?>
To when I interpret your instructions to be - as this:
<?php
$conn = mysqli_connect("localhost", "root", "", "china");
$results = mysqli_query($conn,
" SELECT name
, comment
, DATE_FORMAT(date, '%d/%m/%Y') as date
FROM image");
$image = mysqli_fetch_all($results, MYSQLI_ASSOC);
?>
I get this error
Fatal error: Uncaught TypeError: mysqli_fetch_all(): Argument #1 ($result) must be of type mysqli_result, bool given in C:\xampp\htdocs\china\viewA.php:9 Stack trace: #0 C:\xampp\htdocs\china\viewA.php(9): mysqli_fetch_all(false, 1) #1 {main} thrown in C:\xampp\htdocs\china\viewA.php on line 9
Thanks