Infamous cTz Posted June 6, 2010 Share Posted June 6, 2010 needing some help here... the code below isnt even close seeing how i cant organize by city... something like WHERE $user_class->city ... im lost as you cant tell lol help me [mysql] <?php $result = mysql_query("SELECT * FROM `grpgusers` WHERE `$user_class->city=` ORDER BY `exp` DESC LIMIT 5"); while($line = mysql_fetch_array($result, MYSQL_ASSOC)) { $user_online = new User($line['id']); echo "<div>".$user_online->id.".)".$user_online->formattedname."</div>"; } ?> [/mysql] Quote Link to comment Share on other sites More sharing options...
Zero-Affect Posted June 7, 2010 Share Posted June 7, 2010 I've not had GRPG but with basic mysql i'd so something like $query = mysql_query('SELECT `id`, `name` FROM `users` u LEFT JOIN `city` c ON c.`city` = u.`location` ORDER BY `column` DESC LIMIT 5') while ( $fetched = mysql_fetch_object($query) ) { echo ' <div> '.$fetched->name.' ('.$fetched->id.') </div> '; } Quote Link to comment Share on other sites More sharing options...
Infamous cTz Posted June 8, 2010 Author Share Posted June 8, 2010 [mysql] <?php $result = mysql_query("SELECT * FROM `grpgusers` WHERE `city = $user_class->city` ORDER BY `exp` DESC LIMIT 5"); while($line = mysql_fetch_array($result, MYSQL_ASSOC)) { $user_online = new User($line['id']); echo "<div>".$user_online->id.".)".$user_online->formattedname."</div>"; } ?> [/mysql] i dont understand why this wont work :( Quote Link to comment Share on other sites More sharing options...
Zero-Affect Posted June 8, 2010 Share Posted June 8, 2010 $result = mysql_query('SELECT `id` FROM `grpgusers` WHERE `city` = '.$user_class->city.' ORDER BY `exp` DESC LIMIT 5'); Quote Link to comment Share on other sites More sharing options...
SlanderDesign Posted June 9, 2010 Share Posted June 9, 2010 <?php include (DIRNAME(__FILE__) . '/header.php'); echo '<tr><td class="contenthead">List Of All Complaints</td></tr> <tr><td class="contentcontent">'; $result = mysql_query("SELECT * FROM `grpgusers` WHERE ".$user_class->city." ORDER BY `exp` DESC LIMIT 5"); while($line = mysql_fetch_array($result, MYSQL_ASSOC)) { echo "<div>".mysql_real_escape_string(strip_tags($line['id'])).". ".mysql_real_escape_string(strip_tags($line['username']))."</div>"; } include (DIRNAME(__FILE__) . '/footer.php'); ?> this only works for the EXP not stat's. Regards Linton. PS: Sorry I forgot about making this for you! Quote Link to comment Share on other sites More sharing options...
Jordan Palmer Posted June 9, 2010 Share Posted June 9, 2010 Lookup mysql_real_escape_string.. Linton..you need to visit thst :) Quote Link to comment Share on other sites More sharing options...
SlanderDesign Posted June 9, 2010 Share Posted June 9, 2010 XD this is from my complaints mod... Yeah no need for the mres ect, it did have text but it doesn't no more. Remove it if you want, but it's causing no errors. Regards Linton Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.