Jump to content

Pulling out a feature profile


textbox

Recommended Posts

Hello, id like to pull out a feature profile on one of my pages, and allow it in the feature spot for 24 hours.

 

All i need pullling out is the users picture, headline, location and name which i am fine with.

 

I have no idea where to start on the feature part.

Any help would be great.

 

Nick

Link to comment
https://forums.phpfreaks.com/topic/52475-pulling-out-a-feature-profile/
Share on other sites

If you place another field in your existing users database (small int) you could simply use something like (not tested)....

 

<?php

  // connect to db.

  // remove current featured profile.
  $result = mysql_query("UPDATE users SET featured = 0 WHERE featured = 1;");
  // create new featured profile.
  $result = mysql_query("UPDATE users SET featured = 1 WHERE id = (SELECT RAND(id) FROM users LIMIT 1);");

?>

 

run through cron.

 

Then... on you page to display the featured profile you'd just need....

 

SELECT * FROM users WHERE featured = 1;

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.