Jump to content

Archived

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

cameeob2003

Displaying users with only $members > 0

Recommended Posts

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:

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

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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
[code]
<?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>";
}
?>
[/code]

Share this post


Link to post
Share on other sites

×

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.