close but no cigar.
look at <a href="http://www.phpbuilder.com/forum/read.php3?num=2&id=119812&thread=119811"> this </a> for my comments (change the bottom mysql_fetch_array to mysql_fetch_object).
below is my take on whats going on in your code:
//This is used to query the total number of rows in the database
###select all cid data from mysql and make it available to php
$id = "SELECT CID FROM clients";
$resultid = mysql_query($id);
###have php count the rows (you could do this in mysql using "select count(cid) from clients", probably faster for larger tables)
$num_rows = mysql_num_rows($resultid);
$query = "SELECT CFirstName, CLastName, CCity, CEmail FROM clients,interests WHERE I1 = '$Interests' OR I2 = '$Interests' OR I3 = '$Interests' OR I4 = '$Interests' OR I5 = '$Interests' OR I6 = '$Interests' OR I7 = '$Interests'";
//Loops through the database and print the results of query
###loop for each row
for ($loopvar=0; $loopvar<$num_rows; $loopvar++)
{
//This queries others with the same interests
###run the query to fetch data returning the first row
$result = mysql_query($query);
###return the first row and set the cursor to the next row
$row = mysql_fetch_object($result);
print "$row->CFirstName $row->CLastName $row->CEmail $row->CCity<BR>";
}
so its not looping because you're running the select and returning the first row every time through the loop. place "$result = mysql_query($query);" before the loop.