Okay, I'm a little confused - this code works perfectly fine in mysql; however, in php it keeps repeating the first person for about 15 rows. Can someone point me to what I'm missing here.

$queryUsers = "SELECT user_id, zipcode, gender, housing_status, active, username FROM users WHERE user_id != '" . $_SESSION['user_id'] . "'
					AND active = 1";
	$dataUsers = mysqli_query($dbc, $queryUsers);
	$rowUsers = mysqli_fetch_array($dataUsers);
echo '<table width="100%" border="0" cellspacing="0" cellpadding="0">';
	  while ($row = mysqli_fetch_array($dataUsers)) {

			echo '
				<tr><td class="subtitle" height="30px" colspan="3" align="left" valign="middle">' . $rowUsers['username'] . '</td></tr>
				<tr><td width="21%" rowspan="8" align="center" valign="middle"><img alt="profile picture" name="profilepic" width="100" height="100" id="profile picture" /></td></tr>
				<tr class="oddrow"><td width="21%" align="left" valign="middle">Age:</td><td width="58%">' . $rowUsers['user_id'] . '</td></tr>
				<tr class="evenrow"><td align="left" valign="middle">Gender:</td><td>' . $rowUsers['gender'] . '</td></tr>
				<tr><td align="left" valign="middle">Location:</td><td>&nbsp;</td></tr>
				<tr class="evenrow"><td align="left" valign="middle">Looking for:</td><td>' . $rowUsers['housing_status'] . '</td></tr>
				<tr><td align="left" valign="middle">Has children:</td><td>&nbsp;</td></tr>
				<tr class="evenrow"><td align="left" valign="middle">Type of pets:</td><td>&nbsp;</td></tr>
				<tr class="oddrow"><td align="left" valign="middle">Inside Smoker:</td><td>&nbsp;</td></tr>
				<tr class="subtitle"><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>';
		
	}
	  echo '</table>';

also if i change mysqli_fetch_array to mysqli_num_rows, I get a million empty rows.

I guess it helps if I have the variables named the same ($row = $rowUsers)...

$_SESSION['user_id'] , I guess this is causing problem.
Try

$session_user=$_SESSION['user_id'];
$queryUsers = "SELECT user_id, zipcode, gender, housing_status, active, username FROM users WHERE user_id != '" . $session_user. "' AND active = 1";
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.