Computer Webmaster Gaming Console Graphics Forum

Welcome to the Computer Webmaster Gaming Console Graphics Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

MK PitStop Main Earn $25 Earn Money Posting Extras Members Blogs Image Hosting User Pages
Go Back   Computer Webmaster Gaming Console Graphics Forum > Webmaster Forum > Website Coding > PHP
Register FAQ/Rules Become A V.I.P. Member Search Today's Posts Mark Forums Read

PHP PHP for some can be one of the hardest website programming codes, so do you need help on your PHP script, if it is php4, php5 or lower this is the place for you for any PHP help.

Google
Closed Thread
 
LinkBack Thread Tools Display Modes
Old 07-01-2007, 5:31 PM   #1
M.E.
 
M.E.'s Avatar
 
Posts: n/a
My Photos: (0)

Banked:
MK Cash: $

I am Worth:
MK Cash: $
Donate

Recent Blog: None

Default PHP Search sort help please

Hi,

I have a simple search which is fine for now. Problem is when it is listing
and sorting.
For example It sorts as follows -
A Guy Called Gerald
A-ha
A-ha
Abigail
Ace of Base
Adamski
Adeva
Adrian Belew
Aerosmith
Agro

I want it to ignore the the spaces and special charackters but not numerical
numbers. From the above sort as you can see first three names should come
after the 'Agro'

What would I need to do and how?

Thanks

-----------Search Form ---------------------------
<form action="preport.php?search=true" method="get" name="searchForm"
id="searchForm">
Artist Search <input name="txtSearch" type="text" id="txtSearch3"
size="10" maxlength="30">
<input type="submit" name="Submit" value="Search">
</form>
-------------------------------


-----------search results ---------------------
<?php
$maxRows_rsReport = 20;
$pageNum_rsReport = 0;
if (isset($HTTP_GET_VARS['pageNum_rsReport'])) {
$pageNum_rsReport = $HTTP_GET_VARS['pageNum_rsReport'];
}
$startRow_rsReport = $pageNum_rsReport * $maxRows_rsReport;

$txtSearch_rsReport = "%";
if (isset($HTTP_GET_VARS['txtSearch'])) {
$txtSearch_rsReport = (get_magic_quotes_gpc()) ?
$HTTP_GET_VARS['txtSearch'] : addslashes($HTTP_GET_VARS['txtSearch']);
}
mysql_select_db($database_connMDB, $connMDB);
$query_rsReport = sprintf("SELECT * FROM mdbTable WHERE AlbumArtist LIKE
'%%%s%%' ORDER BY AlbumArtist+0, AlbumArtist ASC ", $txtSearch_rsReport);
$query_limit_rsReport = sprintf("%s LIMIT %d, %d", $query_rsReport,
$startRow_rsReport, $maxRows_rsReport);
$rsReport = mysql_query($query_limit_rsReport, $connMDB) or
die(mysql_error());
$row_rsReport = mysql_fetch_assoc($rsReport);

if (isset($HTTP_GET_VARS['totalRows_rsReport'])) {
$totalRows_rsReport = $HTTP_GET_VARS['totalRows_rsReport'];
} else {
$all_rsReport = mysql_query($query_rsReport);
$totalRows_rsReport = mysql_num_rows($all_rsReport);
}
$totalPages_rsReport = ceil($totalRows_rsReport/$maxRows_rsReport)-1;
?>


 
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Advertisements
Old 07-01-2007, 5:31 PM   #2
Sundial Services
 
Sundial Services's Avatar
 
Posts: n/a
My Photos: (0)

Banked:
MK Cash: $

I am Worth:
MK Cash: $
Donate

Recent Blog: None

Default PHP Search sort help please

You must create a separate database-field that contains a sort-key. Usually
this field is not displayed, but its contents are calculated from the
visible field and stored.

For example, "A ha," "A Ha", and "A-ha" {*great* band, by the way!!} would
all be stored in a sort-key AHA.



M.E. wrote:

> I have a simple search which is fine for now. Problem is when it is
> listing and sorting.
> For example It sorts as follows -
> A Guy Called Gerald
> A-ha
> A-ha
> Abigail
> Ace of Base
> Adamski
> Adeva
> Adrian Belew
> Aerosmith
> Agro
>
> I want it to ignore the the spaces and special charackters but not
> numerical numbers. From the above sort as you can see first three names
> should come after the 'Agro'
>
> What would I need to do and how?
>

 
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Old 07-01-2007, 5:31 PM   #3
RP
 
RP's Avatar
 
Posts: n/a
My Photos: (0)

Banked:
MK Cash: $

I am Worth:
MK Cash: $
Donate

Recent Blog: None

Default PHP Search sort help please


"M.E." <somewhere@downunder.com.au> schreef in bericht
news:bj0u4l$qff$1@otis.netspace.net.au...
> Hi,
>
> I have a simple search which is fine for now. Problem is when it is

listing
> and sorting.


Not an answer to your question but perhaps you have to take a look at the
possibilities of "full-text search" in MySQL.
http://www.mysql.com/doc/en/Fulltext_Search.html

Your search results can be ordered on relevance...

RP





 
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Featured Websites
Free Space
Free Space
Free Space Free Space
Closed Thread
Tags: , , ,




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

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
sort order Kurt Milligan PHP 2 07-01-2007 3:35 PM
How do I sort This array? Karl McAuley PHP 1 07-01-2007 3:18 PM
Was going to come out this year! I was right with my prediction,sort of... Phyber Quest Console Subjects 0 06-26-2007 12:07 PM
Does the PS3 have any sort of buzz about it being hot or a must have? Penguin Commandos for Gore. Computer Consoles 14 05-30-2007 10:03 PM
Sort Gmail by different criteria ~~Alan~~ Google questions 0 05-28-2007 1:45 AM


Featured Websites




All times are GMT +1. The time now is 12:24 AM.


Powered by: vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.0.0
Cheap Computers
MK PitStop Copyright 2005 - 2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98