Last 5 registered members.
#7

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?
Reply


Messages In This Thread
Last 5 registered members. - by Face9000 - 17.10.2013, 11:30
Re: Last 5 registered members. - by Konstantinos - 17.10.2013, 11:36
Re: Last 5 registered members. - by Face9000 - 17.10.2013, 11:44
Re: Last 5 registered members. - by Konstantinos - 17.10.2013, 11:47
Re: Last 5 registered members. - by Face9000 - 17.10.2013, 11:50
Re: Last 5 registered members. - by tyler12 - 17.10.2013, 12:04
Re: Last 5 registered members. - by Face9000 - 17.10.2013, 12:39
Re: Last 5 registered members. - by tyler12 - 17.10.2013, 12:50
Re: Last 5 registered members. - by gtakillerIV - 17.10.2013, 13:03
Re: Last 5 registered members. - by Face9000 - 17.10.2013, 18:29

Forum Jump:


Users browsing this thread: 2 Guest(s)