Jump to content

mysql_fetch_assoc() Only returning 1 value instead of all of them.


MstrGmrDLP

Recommended Posts

Okay, I had a similar problem before.

$users = mysql_query("SELECT * FROM users");

while($users = mysql_fetch_assoc($users)){
		echo "<tr><td><p><a href='users.php?id={$users['user_id']}'>{$users['user_name']}</a></p></td><td>{$users['user_clan']}</td><td>{$users['troop_donations']}</td></tr>";
}
Link to comment
Share on other sites

Try changing the $users in the while loop to something else, I think it's overwritting the $users from the query after the first loop

while($row = mysql_fetch_assoc($users)){
		echo "<tr><td><p><a href='users.php?id={$row['user_id']}'>{$row['user_name']}</a></p></td><td>{$row['user_clan']}</td><td>{$row['troop_donations']}</td></tr>";
}
Link to comment
Share on other sites

Archived

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

×
×
  • Create New...

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.