Quote:
Originally Posted by tyler12
Assuming you're using PHP. You could do something like:
PHP код:
$query = mysql_query("SELECT * FROM `users` ORDER BY `id` DESC LIMIT 5");
while($row = mysql_fetch_assoc($query))
{
$admin = $row['name'];
$image = $row['image'];
echo "$admin - <img src=\"$image\">";
}
|
Ok umh, i was checking my db and i have this tables:
dsb_user_photo
and inside that table, there is the "photo" column, so i guess is where is stored the profile pic of the member.
For username, i have this table:
dsb_user_profiles and there is "_user" column where are stored all the usernames.
So i have to read 2 different tables and 2 different columns.
I made this code to show last 5 registered members (without photo):
PHP код:
$query = mysql_query("SELECT * FROM `dsb_user_profiles` ORDER BY `id` DESC LIMIT 5");
while($row = mysql_fetch_assoc($query))
{
$admin = $row['_user'];
echo "$admin";
}
And this is to show just the photos:
PHP код:
$query = mysql_query("SELECT * FROM `dsb_user_photo` ORDER BY `id` DESC LIMIT 5");
while($row = mysql_fetch_assoc($query))
{
$image = $row['photo'];
echo "<img src=\"$image\">";
}
Now my question is, how to merge this two php codes and make it select two different tables and columns?