Jump to content

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;

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.