Jump to content

How to list new profiles first?


dcibrando

Recommended Posts

I am wanting to list to last 3 registered users on my Alumni website.  How do I do this?  Right now it's just showing the first 3 that registered...not the most recent 3.  Thanks!

 

function new_members() {

   $q1 = "select * from classmates_members where profile_image = '' order by MemberID limit 0,3 ";
   $r1 = mysql_query($q1) or die(mysql_error());
   
   $n = mysql_num_rows($r1);

   $rows = "<table width=\"320\" cellspacing=0 cellpadding=0 align=center>\n<tr>\n\t<td height=20> </td>\n</tr>\n\n";

   if($n > '0')
   {
      while($a1 = mysql_fetch_array($r1))
      {
         $sizes = getimagesize("profile_images/$a1[profile_image]");

         //define the type - lendscape or portrait
         if($sizes[0] > $sizes[1])   //landscape (97 x 64)
         {
            if($sizes[1] > 97)
            {
               $show_size = "whidth=97";
            }
            else
            {
               $show_size = "width=$sizes[0]";
            }
         }
         else     //portrait
         {
            if($sizes[1] > 64)
            {
               $show_size = "height=64";
            }
            else
            {
               $show_size = "height=$sizes[1]";
            }
         }

Link to comment
Share on other sites

Hi,

 

Assuming MemberID is autoincrement field, try this

 

$q1 = "select * from classmates_members where profile_image = '' order by MemberID desc limit 0,3 ";

 

OR

 

if you have a date_joined field in the table sort by that field in descending order.

 

hth

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.