HI Guys
I have an issue, I would like to know if anyone can suggest how I can achieve what I want.
I have two tables, a user table and a media table. The media table has a FK, User_id , referenced to User.User_id.
Table structure User:
user_id
username
password
name
about_me
date_joined
Table structure for Media:
media_id
file_name
file_path
user_id
What I want to do is display the latest three users on the home page, as a sort of profile. SO I created the following.
$data = mysqli_query ($dbc,'SELECT media.file_name, users.username, users.creative_specialism
FROM media
INNER JOIN users
on(media.user_id = users.user_id)
ORDER BY date_joined
LIMIT 1');
if (mysqli_num_rows($data) > 0) {
while ($row = mysqli_fetch_array($data))
{
echo '<div id="image1">';
//echo '<img src="uploadedImages/'.$file_name[0].'.jpg" alt=""/>';
echo'<p>'. $row[''] .'</p>';
echo'<p>'. $row['username'] .'</p>';
echo'<p>'. $row['creative_specialism'] .'</p>';
echo '</div>';
}
}
else {
echo'<p>there are no featured artists</p>';
}
I did have it set to Limit 3, but this code only outputs data for one user. Is there a clause I can use that will help me to display three different usernames?? Or will I have to do this Select Statement differently and run it three times.
Thanks very much for your time. I appreciate any help.
kind regards