PHP/MySQL Help - Is this MySQL Query correct?

09/12/2011 05:36 xBlackPlagu3x#1
$rank = mysql_query("SELECT Name,Level,Class,Online FROM entities ORDER BY Level DESC LIMIT $limit");

I'm pretty sure that is right... whenever I do
Code:
while ($row = mysql_fetch_array($rank)) { ... }

It always gives me a mysql_fetch_array error. I've checked and the database is populated, the columns exist, so what could be the issue?
09/23/2011 13:24 JobvdH#2
The thing i would do is:

Code:
$rank = mysql_query("SELECT * FROM entities ORDER BY Level DESC LIMIT '".$limit."'");
while ($row = mysql_fetch_assoc($rank)) { ... }
After that you can go on with echo the Names,Levels,Classes etc.
Code:
echo $row['Name'];
echo $row['Level'];