0 Members and 1 Guest are viewing this topic.

Need help, sort by desc doesn't work
« on: September 09, 2017, 03:41:13 PM »
hi all,
maybe someone can help.
see attached file.
no matter what i try, the data is not sorted by desc or nothing appears on my site.
i want to sort the data by desc so that newest entries are first.
thanks.

*

Pharg

  • *****
  • 2,793
    • OsDateFourm
  • osDate Version: osDate Evo v1.2
Re: Need help, sort by desc doesn't work
« Reply #1 on: September 09, 2017, 10:47:50 PM »
Hi lenzen24,

What is this for before I even look at it?
Regards,
Pharg ( Phill )

REMEMBER: ALWAYS BACKUP BEFORE YOU MAKE ANY CHANGES!!

osDateEvo v1.2 | PHP: 5.3.42 & PHP: 5.6.18 | MySQL: 5.5.35

Re: Need help, sort by desc doesn't work
« Reply #2 on: September 10, 2017, 06:30:51 AM »
Hi Pharg
It is nothing else like a shoutbox but with other table structure.
This file Shows all entries from Database but with a Limit of 10 entries per Page.
Greetz
lenzen

*

Pharg

  • *****
  • 2,793
    • OsDateFourm
  • osDate Version: osDate Evo v1.2
Re: Need help, sort by desc doesn't work
« Reply #3 on: September 10, 2017, 07:45:48 AM »
Hi lenzen24,

Sorry but I don't understand what it is.

Is it for the points system?
Regards,
Pharg ( Phill )

REMEMBER: ALWAYS BACKUP BEFORE YOU MAKE ANY CHANGES!!

osDateEvo v1.2 | PHP: 5.3.42 & PHP: 5.6.18 | MySQL: 5.5.35

Re: Need help, sort by desc doesn't work
« Reply #4 on: September 10, 2017, 09:30:43 AM »
No, not for the Points System.
I used it at my old website. i have taken a modul (i think it was the guestbook) and changed
it to a new one.
it is like a shoutbox. user can make entries and it appears in a panel.
the grussticker_all.php should show all entries from database.
it works, after 10 entries a new page is generated and shows the next 10 entries.
my problem is that the 10 entries at the first page are the oldest entries.
i want to sort it by newest entries.

*

Pharg

  • *****
  • 2,793
    • OsDateFourm
  • osDate Version: osDate Evo v1.2
Re: Need help, sort by desc doesn't work
« Reply #5 on: September 10, 2017, 10:08:37 AM »
Hi lenzen24,

For starters you need to change on line 12 find:
Code: [Select]
$rsuser =& $osDB->getAll( 'SELECT grussticker_id, from_user, title, act_time, grussticker_entry FROM ! ORDER BY act_time', array( GRUSSTICKER_TABLE ) );
Change to:
Code: [Select]
$rsuser = $osDB->getAll( 'SELECT grussticker_id, from_user, title, act_time, grussticker_entry FROM ! ORDER BY act_time', array( GRUSSTICKER_TABLE ) );
Find line 46:
Code: [Select]
$data =& $osDB->getAll( 'SELECT * FROM ! ORDER BY ' . $sort . " LIMIT $upr,$page_size ", array( GRUSSTICKER_TABLE ) );
Change to:
Code: [Select]
$data = $osDB->getAll( 'SELECT * FROM ! ORDER BY ' . $sort . " LIMIT $upr,$page_size ", array( GRUSSTICKER_TABLE ) );
That should be it.
« Last Edit: September 10, 2017, 10:10:56 AM by Pharg »
Regards,
Pharg ( Phill )

REMEMBER: ALWAYS BACKUP BEFORE YOU MAKE ANY CHANGES!!

osDateEvo v1.2 | PHP: 5.3.42 & PHP: 5.6.18 | MySQL: 5.5.35

Re: Need help, sort by desc doesn't work
« Reply #6 on: September 10, 2017, 07:58:04 PM »
hi pharg,
doesn't work, but thank you for your help.
i think i must intensively think about it.
anything seems to be bad.

*

Pharg

  • *****
  • 2,793
    • OsDateFourm
  • osDate Version: osDate Evo v1.2
Re: Need help, sort by desc doesn't work
« Reply #7 on: September 11, 2017, 12:19:35 AM »
Hi lenzen24,

If you share the entire thing, maybe we can fix it.

Going by just that one php file, that would work in old PHP versions but not in PHP 5.6
The rest of the script might also have changes needed also.
Regards,
Pharg ( Phill )

REMEMBER: ALWAYS BACKUP BEFORE YOU MAKE ANY CHANGES!!

osDateEvo v1.2 | PHP: 5.3.42 & PHP: 5.6.18 | MySQL: 5.5.35

Re: Need help, sort by desc doesn't work
« Reply #8 on: September 11, 2017, 08:18:55 PM »
hi pharg,
i want to give you a short update to my problem.
i've solved it. a look in the admin area
to managearticle.php helps me to solve it.
thank you very much
greetz
lenzen