I want to display all the user account photo and name from database and put one user photo and name in a div tag and similarly with all the accounts with a link that redirect to the clicked account. But I am having problem on how to display it.If its still not clear try picturing an online shopping site where each product with its name is in its own box separately. Please help, I am actually trying to make a social networking site for my educational project. Thank You.
Heres my code:
$sql = "SELECT * FROM user WHERE NOT username = '$username'";
$account = array();
$photo1 = array();
$result = $conn->query($sql);
if($result->num_rows > 0)
{
while($row = $result->fetch_assoc())
{
$account[] = $row['username'];
$a = $row['photo'];
$photo1[] = "<img src = '$a' alt = 'profile photo' width = '100px' height = '100px'>";
}
}
and Heres a section of my html code:
<div>
<?php echo implode(', ',$photo1); ?>
<?php echo implode(', ',$account);?>
</div>
2
Answers
Could you add some wireframe for your task?
In this way i think you need something like this: