PDA

View Full Version : Pulling a list of users based on a field in their profile.


jcroft
12-10-2001, 09:18 PM
Ok, I'm trying to created a list of users who have data entered in their "field8" in the "userfield" table.

I did this:

[QUOTE]
require("/home/newbeetle/public_html/vbulliten/admin/config.php");

$db=mysql_connect($servername,$dbusername,$dbpassw ord);
mysql_select_db($dbname);

$query = "SELECT * FROM userfield WHERE field8 = ''";
$resultlatest = mysql_query($query,$db);

while ($latest_array = mysql_fetch_array($resultlatest)) {
echo "<A HREF=\"http://forums.newbeetle.org/member.php?action=getinfo&userid=$latest_array[userid]\">$latest_array[username]</A>
}

JamesUS
12-11-2001, 05:01 AM
Change your query to this:

SELECT * FROM userfield LEFT JOIN user ON user.userid=userfield.userid WHERE userfield.field8='';

:)

jcroft
12-11-2001, 07:17 PM
Thanks so much. That worked beautifully. :D