CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 Advanced search

Print topic Send  topic

Author Message
Optis
Posted: 11/24/2004, 2:00 PM

Hi,
I have search form with textbox for searc in a grid.
I type in search form for ex. "kmn-20".
I want that grid will display results with records "kmn 20", kmn20" and etc.
It nead that search form must ignore sybols like "-", "/", "+" ....
if i type "kmn 20" or "kmn20" or "kmn-20"
record with value "kmn-20" will display.
Thanks
mrachow


Posts: 509
Posted: 11/25/2004, 12:07 AM

Use regular expressions and replace everything not being a letter or digit by underscore.
I hope your SQL will not give up if there are to many of them.

What I'm not sure about is the right event. I would give BeforeUnload (page) a try for substituting the value of the textbox control.

Reagrds,
Michael
_________________
Best regards,
Michael
View profile  Send private message
optis
Posted: 11/25/2004, 5:42 AM

How to replace?
If I type in search form "aaa-20" the records with velues "aaa20", "aaa/20" must be displayed at grid ....
How to do that?

Thanks

optis
mrachow


Posts: 509
Posted: 11/25/2004, 2:07 PM

I can think of two solutions at the moment.
Retrieve the value the user had entered.
Create 3 different values using PHP ereg_replace
a) substitude special chars by nothing (aaa20)
b) by one underscore (aaa_20)
and for safety
c) by two underscores (aaa__20)

Store every value in a hidden field or a session variable

For the where clause use these three values in LIKE clauses as included (e.g. %...%) combining them by or.

Would give you [yoursearchfield] like'%aaa20%' or [yoursearchfield] like'%aaa_20%' or [yoursearchfield] like'%aaa__20%' .

This should do.

Kindly regards,
Michael
_________________
Best regards,
Michael
View profile  Send private message
optis
Posted: 11/26/2004, 12:32 AM

Thanks.
It is one of solutions.
But I need ignore about 10 symbols. it means - i must do about 10 variables. is the more general solution?
mrachow


Posts: 509
Posted: 11/26/2004, 5:46 AM

These 3 variable are covering the situations that the user enters aaa and 20 without any character between or he when he would enter one or two characters of any kind between aaa and 20.

You can replace the character(s) between aaa and 20 by % but this will find aaa and 20 when any high number of other characters are between them.

Regards,
Michael
_________________
Best regards,
Michael
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.