Re: search in serialized string
| From: | DL Neil | Date: | Sat, 24 Aug 2002 14:45:45 +0000 |
| Subject: | Re: search in serialized string | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-113939@lists.php.net to get a copy of this message | ||
Hi Rodrigo,
> I have a form to post resumes. In one parte the user have a option to
choose
> up to 5 languages and his knowledge in it. example : english: basic
advanced
> ....
> My problem is that was stored serialized in the BD and now I need to do a
> search by language and knowledge. How can I do this. I've tried everything
> unsuccessfully. example: search english advanced. If the user have english
> basic and another advanced he/her appear in the search.
Is it my imagination or have we seen this question posted to the list
numerous times?
Can we assume a "BD" means db/database?
What do you mean by "serialised"?
If I speak English very well and can managed basic greetings etc in Spanish
would you enter both of my (supposed) language skills in one field or would
each language appear in its own field/separate rows?
If the table is properly designed/normalised, ie each language and level of
skill is in its own field, then why can't you do something like:
...WHERE field LIKE "%english%" AND field LIKE "%advanced%"
However I would think about having a field for language-name accompanied by
another field for skill-level. This would get you away from those wild-cards
and into faster queries that can use indexes, eg
...WHERE ( language = "english" ) AND ( level = "advanced" ) --or even
"A"
for advanced
Perhaps if you gave us some examples of what you want to happen, and the
code you are currently using, we could offer more specific information -
repeating an unsuccessful question invites repetition of the non-answer!
Regards,
=dn