Sponsored by NuSphere - PHP Software for PHP Application Developers - On Sale This Week for $100



Go Back   PHP-Editors > Linux, Apache, MySQL > MySQL Help

MySQL Help Post any question relating to MySQL here and hopefully someone can help

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 2004-07-15, 06:46 AM
Aaron Whiffin
Guest
 
Posts: n/a
Default

My ISP uses MySQL 3.23.58 so I can't use FULLTEXT searches as I need results returned if more tha 50% of mydata set.

So I'm resorting to queries such as:

SELECT * from advert WHERE description REGEXP 'golf | gti';

Two questions:

1. How can I modify the REGEXP so that it searches for the words 'golf' AND 'gti' rather than 'golf' OR 'gti' ??

2. How can I modify the query so that it it searches through the fields description and title rather than just description (a tidy way as I need to search though about 7 different fields as it's a keyword search)

All help appreciated

Thanks
Reply With Quote
  #2 (permalink)  
Old 2004-07-17, 03:26 AM
Mke Willits
Guest
 
Posts: n/a
Default

Hello Aaron, I believe all you would have to do is the following:

1. SELECT * FROM advert WHERE description REGEXP 'golf' AND description REGEXP 'gti';

I don't know if this is tidy enough, but you can keep adding AND qualifiers to the query string for each field. I have to admit, I'm quite new to SQL myself so there may be much better ways to do this:

2. SELECT * FROM advert WHERE description REGEXP 'golf' AND description REGEXP 'gti' AND field1 REGEXP 'exp1' AND fieldN REGEXP 'expN';

I should also mention I'm using MySQL 4.0.15 if that's relevant.

Hope this helps.
Reply With Quote
Must read Review for Serious PHP Developers


NuSphere PhpED 5.5 : The Staff of php-editors.com recently spent a few days working with NuSphere PhpED 5.5 (a popular PHP IDE) and NuCoder 2.0 (a PHP Encoding Utility), read up on all the details.

Sponsored Links
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 11:25 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0
© Copyright 2003-2008 www.php-editors.com. The ultimate PHP Editor and PHP IDE site.