Jump to content


Photo

Displaying users with only $members > 0


  • Please log in to reply
3 replies to this topic

#1 cameeob2003

cameeob2003
  • Members
  • PipPipPip
  • Advanced Member
  • 79 posts

Posted 01 July 2006 - 03:35 PM

I want to display all the users in my database with the value of members greater than the default of 0. I already have the following code:

<?php
$member = $_SESSION['member']
if($member > 0){
}
?>

I just cant figure out how to get it to display only the users with a greater value than 0. I am kinda new to the entire php thing but learning so any help is appreciated.

#2 shocker-z

shocker-z
  • Members
  • PipPipPip
  • Advanced Member
  • 864 posts
  • LocationNottingham

Posted 01 July 2006 - 03:59 PM

Where are you storing all your data as at the moment your settings $member as $_SESSION['member'] but where is $_SESSION['member'] defined?

Regards
Liam
www: www.ukchat.ws | irc: irc.ukchat.ws chan: #blufudge

#3 cameeob2003

cameeob2003
  • Members
  • PipPipPip
  • Advanced Member
  • 79 posts

Posted 01 July 2006 - 04:03 PM

I have my $_SESSION['member'] defined in my login script prior to me using that code. I did this to basicaly pre-load the users entire settings. If this doesnt work then how would I define this before calling for it.

#4 .josh

.josh
  • Staff Alumni
  • .josh
  • 14,871 posts

Posted 01 July 2006 - 04:59 PM

<?php
$sql = "select * from tablename where members > 0";
$result = mysql_query($sql);
while($list = mysql_fetch_array($result)) {
  //example column names. use your own   
  echo $list['membername'] . " " . $list['members'] . "<br>";
}
?>

Did I help you? Feeling generous? Buy me lunch! 
Please, take the time and do some research and find out how much it would have cost you to get your help from a decent paid-for source. A "roll-of-the-dice" freelancer will charge you $5-$15/hr. A decent entry level freelancer will charge you around $15-30/hr. A professional will charge you anywhere from $50-$100/hr. An agency will charge anywhere from $100-$250/hr. Think about all this when soliciting for help here. Think about how much money you are making from the work you are asking for help on. No, we do not expect you to pay for the help given here, but donating a few bucks is a fraction of the cost of what you would have paid, shows your appreciation, helps motivate people to keep offering help without the pricetag, and helps make this a higher quality free-help community :)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users