View Single Post
  #1 (permalink)  
Old 07-14-2004, 08:15 AM
icb01co2 icb01co2 is offline
WebProWorld Pro
 

Join Date: Feb 2004
Location: England Baby!
Posts: 222
icb01co2 RepRank 0
Default Search function mySQL problem

Hi all,
I have a problem that i hope you can help me with. I am developing a site for a training company http://www.pitmanskills.com. The problem is that there is a course search within the site that isnt working to plan. The courses are held in a mySQL database with the following fields;

Title, Aims and Objectives, Prerequsites, Course Content etc.

Originally i used an SQL statement to select from by courses by the course title, this wasnt sufficient as when searching for 'databases' our MSAccess courses werent found. Next i used all fields to get the information. This again isnt right because selecting by all these fields means the most appropriate course appears miles down the list returned.

i.e. when searhing for "word" the "word 2000 expert" course appear below several other non-relevent courses with the word "word" in on of their fields.

How do i select all the results from the following statement :-


select * from pitman_courses
where `Course_Title` like \"%$trimmed%\"
OR `Target_Audience` like \"%$trimmed%\"
OR `Prerequisites` like \"%$trimmed%\"
OR `Aims_and_objectives` like \"%$trimmed%\"
OR `Course_Content` like \"%$trimmed%\"
order by Course_Title


But then put the results returned by;

select * from pitman_courses
where `Course_Title` like \"%$trimmed%\"


at the top?

Thanks, Chris.
Reply With Quote