CodeCharge Studio
search Register Login  

Web Reporting

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

YesSoftware Forums -> CodeCharge Studio -> General/Other

 [TIP] Keyword search

Print topic Send  topic

Author Message
mlapl1

Posts: 66
Posted: 05/29/2008, 4:37 PM

Hello again

I am trying to set up a searchable field of keywords. This field would contain keywords in the form: adventure story book (or whatever - there could be a separaor other than a space if necessary)

Obviously I can search by entering into the search form a string or a partial string which exists as a sequence in the field, e.g. "adventure story" or even "ry book"

BUT

What I would like to be able to do is to wildcard the search in some way so that I might enter the word "adventure" and then the word "book" (which are not sequential in the above string of characters) in the same query and find the correct record in the database.

Any idea how to do this more or less automatically through CCS4? I suppose one could write some complex SQL code and use the mysql function for searching text fields etc, but it would be so nice if a ready-made solution could be available especially as I have not written SQL code into any CCS form at this stage - nor am I experienced in writing such code.

Thank you as ever.

Andrew


View profile  Send private message
wkempees


Posts: 1679
Posted: 05/30/2008, 2:13 AM

http://forums.codecharge.com/posts.php?post_id=94083
See if this is any help to you.
What programming language are you using, what DB?

Walter
_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)

if you liked this info PAYPAL me: http://donate.consultair.eu
View profile  Send private message
mlapl1

Posts: 66
Posted: 05/30/2008, 2:20 AM

Hello Walter

I had a feeling you would reply to this and I am very grateful that you have. Our timezones are very different - I think you are in Europe (Holland?), your morning and I am in the US - the middle of the night :-(

I am using a standar LAMP environment - PHP and MySQL therefore.

Thanks! I will take a close look - everything you have said in the past has been great advice.

Andrew
View profile  Send private message
mlapl1

Posts: 66
Posted: 05/30/2008, 3:32 AM

Hello again Walter,

A little more help (I am not an expert in php although I used to code in C years ago).

You suggested code at :

http://forums.codecharge.com/posts.php?post_id=94083

The following line in feha's code returns an error:

CCGetFromGet(s_keyword,"")

He says it should be:

CCGetFromGet("s_keyword","")

That does not help either. I get errors with BOTH formulations. Any suggestions? I will look further into it too - but your expert eye could well see the problem immediately.

Thanks
Andrew
View profile  Send private message
mlapl1

Posts: 66
Posted: 05/30/2008, 4:23 AM

There seems to be a problem with the processing of the second parameter in CCGetfromGet above (at least with my version of MySQL). The code works fine so long as I have something in my search field. If I have nothing I get an SQL error as below:

"Database Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 3
Database Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') ORDER BY Name LIMIT 0,10' at line 3 "

I know it is not your job to fix other people' s SQL , so I will try and figure it out myself but it may be a problem with CCGetFromGet.

Thanks anyway, just thouht I would mention it.

Andrew



View profile  Send private message
datadoit
Posted: 05/30/2008, 6:13 AM

That's correct. The BeforeBuildSelect is building the Where parameters,
with or without a value in the search form.

To get around that so that folks aren't just clicking the Search button
without a value, put in validation code for the form's search field. If
you don't mind the generic CCS error message ("Value in field xxx is
required"), then simply set the form field's Required value to 'Yes' -
then no programming will be necessary.

There are occasions where I will want someone to simply browse every
record by doing an empty search. For those, you can update the
BeforeBuildSelect by placing the entire code in an if/then statement:

if (CCGetFromGet("s_keyword","")) {
yada yada yada
} //end if a value.
mlapl1

Posts: 66
Posted: 05/30/2008, 6:31 AM

Thank you Walter and datadoit - I appreciate the help - it all seems to be working now
Andrew
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.