Reply to Re: search only certain columns in 1 table using php

Your name:

Reply:


Posted by Mark D. Smith on 06/24/06 17:46

"Rik" <luiheidsgoeroe@hotmail.com> wrote in message
news:8afe9$449d6d0f$8259c69c$13517@news2.tudelft.nl...
> Mark D. Smith wrote:
> > Hi
> >
> > i want to only do a REGEXP against 4 columns in a table
> >
> > Job_Title | Job_Description | Job_Salary | Job_Location
> >
> > i tried $sql = "SELECT * FROM Jobs WHERE (Job_Title, Job_Description,
> > Job_Salary, Job_Location) REGEXP '$search'"
> >
> > but its not a valid SQL statement. also tried with WHERE (Job_Title OR
> > Job_Description OR Job_Salary OR Job_Location)
>
> What regex, what does it need to validate?
> Maybe:
> SELECT * FROM Jobs WHERE CONCAT(Job_Title, Job_Description, Job_Salary,
> Job_Location) REGEXP '$search'
> or
> SELECT * FROM Jobs WHERE Job_Title REGEXP '$search' OR Job_Description
> REGEXP '$search' OR Job_Salary REGEXP '$search' OR Job_Location REGEXP
> '$search'
>
> Depending on your exact needs. What are you trying to acconbmplish, what
> data is in the columns, what is in the regex?
>
> Grtz,
> --
> Rik Wasmus
>
>
Hi

all the columns are longtext and for example in Job_Location it might be
looking for England same could be in Job_Description.

using SELECT * FROM Jobs WHERE CONCAT(Job_Title, Job_Description,
Job_Salary, Job_Location) REGEXP '$search'

looks like it will do as it gets part and whole words. common words in title
& description are Salary & Manager

Mark

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация