How to add sort function?

07-14-08, 06:23 PM
|
|
Newbie Coder
|
|
Join Date: Feb 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
|
How to add sort function?
Hi! First of all, I have very very veeeeeeeeery limited PHP experience. Close to none, actually. Anyway, I'm using the script PHP Links v1.3 by DeltaScripts. The script is good and fine but it doesn't have a sort function! It's all sorted by date added and I would like to be able to sort it by link title.
Can anyone tell me how I can add this sort function to the script? The DeltaScripts support forum doesn't seem to be very active... Any help would be appreciated, thanks!
|

07-14-08, 06:54 PM
|
 |
Code Master
|
|
Join Date: Jun 2003
Location: North East England/UK
Posts: 874
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Does it read a table from a database?
if so, then its just a case of changing the ORDER BY part to something other than the date field ASC/DESC
Dal
__________________
"once upon a midnight dreary, while i pron surfed, weak and weary, over many a strange and spurious site of 'hot xxx galore'. While i clicked my fav'rite bookmark, suddenly there came a warning, and my heart was filled with mourning, mourning for my dear amour," 'Tis not possible!", i muttered, "give me back my free hardcore!" quoth the server, 404."
|

07-14-08, 07:00 PM
|
|
Newbie Coder
|
|
Join Date: Feb 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Quote:
Originally Posted by DAL
Does it read a table from a database?
if so, then its just a case of changing the ORDER BY part to something other than the date field ASC/DESC
|
Hi. Yes it does but I don't see anything in the database tables that specifies sort order.
|

07-14-08, 07:11 PM
|
 |
Code Master
|
|
Join Date: Jun 2003
Location: North East England/UK
Posts: 874
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Its not going to be 'IN' the database its going to be inside a PHP script. just open the php script up and edit>find "ORDER BY" and you should from that begin to understand how to change it.
If you want a dynamic script so the user can select between different sort by data then script requests on this forum would be the place to ask. (If you request a script here then your post will just be booted)
If you want to make it yourself, consider looking somewhere like;
http://www.tizag.com/phpT/
http://www.w3schools.com/PHP/DEfaULT.asP
http://www.quirksmode.org
for good reference guides try;
http://www.php.net
and o'reilly ref has also been good.
Good luck. Im off to watch a film now
Kind regards
Dal
__________________
"once upon a midnight dreary, while i pron surfed, weak and weary, over many a strange and spurious site of 'hot xxx galore'. While i clicked my fav'rite bookmark, suddenly there came a warning, and my heart was filled with mourning, mourning for my dear amour," 'Tis not possible!", i muttered, "give me back my free hardcore!" quoth the server, 404."
|

07-14-08, 07:15 PM
|
|
Newbie Coder
|
|
Join Date: Feb 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Oh yay! I found it in index.php and changed it to sort "link_title asc" and now it's sorting by link title! Thanks so much for your help, really appreciate it!
|

07-14-08, 07:17 PM
|
 |
Code Master
|
|
Join Date: Jun 2003
Location: North East England/UK
Posts: 874
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Cool. Its great when problems get solved. Another happy client of PHP/MySQL
M$ you can learn from this, is called happy people!! Im on my soapbox again
Sorry the long hours are starting to get to me :s
Good luck on getting everything else sorted CWY.net oh and we mark threads as SOLVED around here now if you hadnt noticed. Cool feature

__________________
"once upon a midnight dreary, while i pron surfed, weak and weary, over many a strange and spurious site of 'hot xxx galore'. While i clicked my fav'rite bookmark, suddenly there came a warning, and my heart was filled with mourning, mourning for my dear amour," 'Tis not possible!", i muttered, "give me back my free hardcore!" quoth the server, 404."
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|