Current location: Hot Scripts Forums » Programming Languages » PHP » How to add sort function?


How to add sort function?

Reply
  #1 (permalink)  
Old 07-14-08, 06:23 PM
CWY.net CWY.net is offline
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!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 07-14-08, 06:54 PM
DAL's Avatar
DAL DAL is offline
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."
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 07-14-08, 07:00 PM
CWY.net CWY.net is offline
Newbie Coder
 
Join Date: Feb 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by DAL View Post
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 07-14-08, 07:11 PM
DAL's Avatar
DAL DAL is offline
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."
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #5 (permalink)  
Old 07-14-08, 07:15 PM
CWY.net CWY.net is offline
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!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #6 (permalink)  
Old 07-14-08, 07:17 PM
DAL's Avatar
DAL DAL is offline
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."
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[2005] StartPosition for CommonDialogs? tim8w Windows .NET Programming 10 01-08-09 04:39 AM
Add and Delete function can perform together at the same time? Elaine ASP.NET 3 12-18-06 01:29 PM
ASP upload prob minority ASP 1 06-27-05 09:35 AM
PHP Error Fairnie PHP 8 06-26-04 08:15 AM
Help trim code down TheLaughingBandit JavaScript 0 09-02-03 10:50 AM


All times are GMT -5. The time now is 10:13 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.