| |||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | #1 (permalink) |
| Soon to be RICHdoggie! | Fulltext mysql search? here is my mysql code: Code: SELECT * FROM pd_shops WHERE MATCH (name, description, keywords) AGAINST ('$q')
I have 1 entry in my db, that is "Casino Tropez". Supposedly, if you were to type in "Casino" it should pick up "Casino Tropez" in the name field, right? It dosen't Fulltext search page - www.theshutter.co.uk/poordoggie/search/index.php "Like" search page - http://www.theshutter.co.uk/poordogg.../indexlike.php Type "casino tropez" into them both. The like one will work, and the other one wont! MAKE SURE YOU SELECT "BOTH" INSTEAD OF "UK" OR "USA". I DON'T HAVE THE COUNTRIES LOADED YET...If I use the query: Code: SELECT * FROM pd_shops WHERE name LIKE '$q' Can anyone help me, please! ![]() Thanks Tom
__________________ █ Exchange your long URL for a much smaller one! █ Free Anonymizer/Proxy █ Taz Martin's blog - Learn all about internet marketing, promoting your website and much more! Last edited by PoorDoggie; 09-19-2005 at 09:46 AM. |
| |
| | #2 (permalink) |
| Pro Coder & Designer | Code: SELECT * FROM pd_shops WHERE name LIKE '%$q%'
__________________ Online Dragonball Game |
| |
| | #6 (permalink) | |||
| Soon to be RICHdoggie! | Quote:
Quote:
Quote:
So, If I have: "This casino is very good" and I searched for "Casino" I want to be able to single out "casino" in the description and make it bold: This casino is very good. | |||
| |
| | #9 (permalink) | |
| Soon to be RICHdoggie! | Quote:
Sorry to keep troubling everyone, but I seem to have come across another problem. Lets say I want to search up all records with "$q" in them, but I also want to filter it by a country. So for instance... if the user selects UK, I want the database to search all records with the search term, and where the country is "UK", or "Both"... This code won't work: Code: SELECT * FROM pd_shops WHERE name LIKE '%$q%' OR description LIKE '%$q%' OR keywords LIKE '%$q%' AND country='uk' OR country='both' Thanks be to anyone who can help me, and has already helped me... ![]() Tom | |
| |
| | #10 (permalink) |
| NamePros Regular | You need to group your last 'or' statement, like so: Code: SELECT * FROM pd_shops WHERE name LIKE '%$q%' OR description LIKE '%$q%' OR keywords LIKE '%$q%' AND (country='uk' OR country='both')
__________________ OnlineGames.net |
| |
| | #11 (permalink) |
| NamePros Regular | <?php $query = "SELECT * FROM search where keywords like $serch ORDER BY hitid"; $array = mysql_query($query); $items = mysql_num_rows($query); if($items < 1){ die("nuttin");} else { echo " Your search returned $items results.";} while($sql = mysql_fetch_array($array)){ echo "<P><a href=\"".$sql['url']."\">".$sql['title']."</a><BR><HR>".$sql['discription']."</P>}"; ?> |
| |
| | #12 (permalink) | ||
| Soon to be RICHdoggie! | Quote:
Thanks! ![]() Quote:
Code: SELECT * FROM pd_shops WHERE name LIKE '%$q%' OR description LIKE '%$q%' OR keywords LIKE '%$q%' AND (country='usa' OR country='both') ![]() Please help ![]() thanks Know what: scrap that - I won't have a countries thing at the moment... just base it all in UK. When I need to get another country I will get that ccTLD and just use that! woo! all sortedThanks for everyone's help... thanks a lot! | ||
| |
| | #13 (permalink) |
| NamePros Regular | Group the rest of the where... Code: SELECT * FROM pd_shops WHERE (name LIKE '%$q%' OR description LIKE '%$q%' OR keywords LIKE '%$q%') AND (country='usa' OR country='both')
__________________ OnlineGames.net |
| |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Googlism - What does google think of you? | deadserious | The Break Room | 55 | 12-15-2005 09:09 AM |
| AdultSearch.us | Monsterman | Adult Domains For Sale | 3 | 06-11-2004 07:54 AM |
| What should a US Adult Search be going for? | Monsterman | Adult Domain & Site Reviews | 0 | 06-10-2004 12:29 PM |
| Tutorial: Getting Started With MySQL (The Basics) | deadserious | Webmaster Tutorials | 3 | 04-18-2004 01:17 PM |