Old 07-10-2005   #1 (permalink)
Registered User
 
Join Date: Jul 2005
Location: Belgium
Posts: 3

Arrow Creating a Memberlist

I have taken the tutorial provided on the biorust design website to create a member area on my site, and it worked out fine, but I'd like to have a little more. I would like for my members to be able to search other members in a memberlist and to see their profile later on. I'd like it so that once the account is Activated, the member gets added to the memberlist. I've got this code for it, but it doesn't want to work: the problem is, that even though there's a member whose name starts with A (or B, C,...) it keeps saying there aren't any members whose name starts with A (or b, c). Did that make sence?

Anyway, here's the code I used:
Code:
<?php 

include 'config.php';

// For global registers off 
// ==================== 

$a = mysql_escape_string(trim($_GET['a'])); 

if (empty($a))    { $a = 'a';    } 

// display alphabets from A to Z for visitors to sort the list. 
?><p align="center"><a href="memberlist.php?a=1">1</a> | <a href="memberlist.php?a=2">2</a> | <a href="memberlist.php?a=3">3</a> 
| <a href="memberlist.php?a=4">4</a> | <a href="memberlist.php?a=5">5</a>
 | <a href="memberlist.php?a=6">6</a> | <a href="memberlist.php?a=7">7</a> | <a href="memberlist.php?a=8">8</a> | <a href="memberlist.php?a=9">9</a> 
| <a href="memberlist.php?a=0">0</a><br>
<a href="memberlist.php?a=A">A</a> | <a href="memberlist.php?a=B">B</a> 
| <a href="memberlist.php?a=C">C</a> | <a href="memberlist.php?a=D">D</a> | <a href="memberlist.php?a=e">E</a> | <a href="memberlist.php?a=F">F</a> 
| <a href="memberlist.php?a=G">G</a>  | <a href="memberlist.php?a=H">H</a>
 | <a href="memberlist.php?a=I">I</a> | <a href="memberlist.php?a=J">J</a> | <a href="memberlist.php?a=K">K</a> | <a href="memberlist.php?a=L">L</a>
 | <a href="memberlist.php?a=M">M</a><br>
 <a href="memberlist.php?a=N">N</a> | <a href="memberlist.php?a=O">O</a>
 | <a href="memberlist.php?a=P">P</a> | <a href="memberlist.php?a=Q">Q</a> | <a href="memberlist.php?a=R">R</a> | <a href="memberlist.php?a=S">S</a>
 | <a href="memberlist.php?a=T">T</a> | <a href="memberlist.php?a=U">U</a> | <a href="memberlist.php?a=V">V</a> | <a href="memberlist.php?a=W">W</a> 
| <a href="memberlist.php?a=X">X</a> | <a href="memberlist.php?a=Y">Y</a> 
| <a href="memberlist.php?a=Z">Z</a> 
</p>


<?php 

// get list of members 
$query = "select Username, id from Users where Activated='1' and name like '$a%' order by name "; 
$result = mysql_query($query) or die(mysql_error()); 

if (mysql_num_rows($result) !=0) 
{ 
    echo '<ol>'; 
    while($row = mysql_fetch_array($result)) 
    { 
        extract($row); 
        echo '<li><a href="viewprofile.php?id='.$id.'">'.$name.'</a></li>'; 
    } #while 
    echo '</ol>'; 
} 
else 
{ 
    echo '<p>No member names starting with '.$a.'</p>'; 
} 
?>
^^So, what's wrong with it?
Robyn is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 07-11-2005   #2 (permalink)
code anyone?
 
scrowler's Avatar
 
Join Date: Feb 2004
Location: New Zealand
Posts: 590

Send a message via MSN to scrowler Send a message via Skype™ to scrowler
perhaps:

Code:
$query = "select Username, id from Users where Activated='1' and name like '$a%' order by name ";
should be:

Code:
$query = "select Username, id from Users where Activated='1' and name like '$a%' order by Name ASC";
what happens when you run it?
__________________
BioRUST Tutorials - the birthplace
scrowler is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 07-11-2005   #3 (permalink)
Registered User
 
Join Date: Jul 2005
Location: Belgium
Posts: 3

Okay now it displays a number. Like you have a member starting with M, it displays the number 1, instead of the Member's name...
Robyn is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 07-11-2005   #4 (permalink)
code anyone?
 
scrowler's Avatar
 
Join Date: Feb 2004
Location: New Zealand
Posts: 590

Send a message via MSN to scrowler Send a message via Skype™ to scrowler
try using this php code instead:

Code:
<?php 

// get list of members 
$query = "SELECT Username, id, Name FROM Users WHERE Activated='1' AND Name LIKE '$a%' ORDER BY Name ASC"; 
$result = mysql_query($query) or die(mysql_error()); 

if (mysql_num_rows($result) !=0) 
{ 
    echo '<ol>'; 
    while($row = mysql_fetch_assoc($result)) 
    { 
        echo '<li><a href="viewprofile.php?id='.$row["id"].'">'.$row["Name"].'</a></li>'; 
    } #while 
    echo '</ol>'; 
} 
else 
{ 
    echo '<p>No member names starting with '.$a.'</p>'; 
} 
?>
__________________
BioRUST Tutorials - the birthplace

Last edited by scrowler; 07-11-2005 at 08:30 PM.
scrowler is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 07-12-2005   #5 (permalink)
Registered User
 
Join Date: Jul 2005
Location: Belgium
Posts: 3

Now that worked. Thank you.
Robyn is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 07-14-2005   #6 (permalink)
code anyone?
 
scrowler's Avatar
 
Join Date: Feb 2004
Location: New Zealand
Posts: 590

Send a message via MSN to scrowler Send a message via Skype™ to scrowler
no problem, i hope you stick around at biorust
__________________
BioRUST Tutorials - the birthplace
scrowler is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating 3D Grunge zulu Adobe Photoshop 11 11-16-2004 04:49 AM
Creating curved brushes ... Yawgmoth Adobe Photoshop 3 11-03-2003 01:21 PM


All times are GMT +1. The time now is 09:03 AM.
Content Relevant URLs by vBSEO 3.2.0

Design & Content © BioRUST 2008 :: PRIVACY STATEMENT :: LEGAL INFORMATION :: ADVERTISING MEDIA KIT