Hi FOlks,
I know the search question has been covered many times but here is just a varience on it.
I'm developing a website for an IT recruitment agency
and would like some info on the following.
I have a html textfield for searching for jobs and the text field accepts input from the user regarding their skills set.
This can be just one word (eg. HTML) or several (eg. JAVA C++ PHP ASP).
I need to use these words to search a field, 'description', in a MySQL database. 'Description' holds information on a vacancy including the skills required.
The way i thought to do this was to 'explode' the returned string from the form, and assign them to variables and use a query such as:
SELECT * FROM tablename WHERE description LIKE
'%$desc1%' AND description LIKE '%$desc2%' AND
description LIKE '%$desc3%' ..... and so on......
However i do not know the number of skills that the user may enter and also what if the user enters a string like 'visual basic' where it should be read as one variable but may get split into two because of the
space inbetween.
also i need the search to return results firstly using
'desc1' AND 'desc2' AND 'desc3' syntax, then once that is exhusted, i need it to return results where only one or two of the words are mentioned.
There are several points here that i have mentioned and I hope some one is able to follow what i have said, and also possibly provide a suitable solution.
A point to bear in mind is that the database is unlikely to hold more than 1000 entries at any time and typically will hold 150-300 entries. Therefore, not being particularly big, i don't think i want to set up a seperate table that hold key words etc (unless this is very simple to setup and integrate).
My main concern is how do i manage a variable number of keywords, and also how do i manage a string such as 'visual basic', which should be seen by PHP and MySQL as one variable, rather than two seperate variables (eg 'visual' and 'basic').
Many thanks in advance,
Vikesh.
I know the search question has been covered many times but here is just a varience on it.
I'm developing a website for an IT recruitment agency
and would like some info on the following.
I have a html textfield for searching for jobs and the text field accepts input from the user regarding their skills set.
This can be just one word (eg. HTML) or several (eg. JAVA C++ PHP ASP).
I need to use these words to search a field, 'description', in a MySQL database. 'Description' holds information on a vacancy including the skills required.
The way i thought to do this was to 'explode' the returned string from the form, and assign them to variables and use a query such as:
SELECT * FROM tablename WHERE description LIKE
'%$desc1%' AND description LIKE '%$desc2%' AND
description LIKE '%$desc3%' ..... and so on......
However i do not know the number of skills that the user may enter and also what if the user enters a string like 'visual basic' where it should be read as one variable but may get split into two because of the
space inbetween.
also i need the search to return results firstly using
'desc1' AND 'desc2' AND 'desc3' syntax, then once that is exhusted, i need it to return results where only one or two of the words are mentioned.
There are several points here that i have mentioned and I hope some one is able to follow what i have said, and also possibly provide a suitable solution.
A point to bear in mind is that the database is unlikely to hold more than 1000 entries at any time and typically will hold 150-300 entries. Therefore, not being particularly big, i don't think i want to set up a seperate table that hold key words etc (unless this is very simple to setup and integrate).
My main concern is how do i manage a variable number of keywords, and also how do i manage a string such as 'visual basic', which should be seen by PHP and MySQL as one variable, rather than two seperate variables (eg 'visual' and 'basic').
Many thanks in advance,
Vikesh.