*

Recent

Author Topic: Abc order  (Read 3280 times)

Reg

  • Newbie
  • *
  • Posts: 7
  • Force: +0/-0
Abc order
« on: May 22, 2009, 05:32:30 PM »
is there anyway to make it when I post a game it makes it in abc order?

kurt

  • Developer
  • Hero Member
  • ******
  • Posts: 634
  • Force: +16/-1
Re: Abc order
« Reply #1 on: May 22, 2009, 09:00:03 PM »
If you want them in alphabetical order in the main page open up pages/base_home.php and find

Code: [Select]

$ir = $db->query(sprintf('SELECT * FROM dd_games WHERE category=\'%u\' ORDER BY rand() LIMIT 0,'.$limitboxgames.'', $row['ID']));
     


and edit to read

Code: [Select]

$ir = $db->query(sprintf('SELECT * FROM dd_games WHERE category=\'%u\' ORDER BY name ASC LIMIT 0,'.$limitboxgames.'', $row['ID']));
     


To change it in the browse a category open pages/browse.php and find

Code: [Select]

$r = $db->query(sprintf('SELECT * FROM dd_games WHERE category=\'%u\' LIMIT '.$limits.','.$max.' ', $ID));


and edit to read

Code: [Select]

$r = $db->query(sprintf('SELECT * FROM dd_games WHERE category=\'%u\' ORDER BY name ASC LIMIT '.$limits.','.$max.' ', $ID));


and that should do it. Tell me one wa or the other if it works or not? I'm not where I can do much right now so I might have it off a bit.

Reg

  • Newbie
  • *
  • Posts: 7
  • Force: +0/-0
Re: Abc order
« Reply #2 on: May 23, 2009, 12:01:01 AM »
ok and if I wanted it to be by rating it would be like order by rating?

kurt

  • Developer
  • Hero Member
  • ******
  • Posts: 634
  • Force: +16/-1
Re: Abc order
« Reply #3 on: May 23, 2009, 12:51:52 AM »
Not quite. "name" is acually the name of a field in the table dd_games where as "rating" is the name of a totaly different table. You would need to load all of the entries in the the table "rating" into an array, count up which games had the most points, and use that. A lot more complicated. You could add a field "ratings" to the dd_games table and run a cron job to do it on a periodic basis, then feed the results into that field. But one way or another you would need to run that type of calculation in order to get those type results.