Affiliate Marketing
Forum Search

Reply
 
LinkBack Thread Tools Display Modes

  #1 (permalink)  
Old 11-09-04
andy_jacko's Avatar
curiouser and curiouser
 
Join Date: Sep 2003
Location: uk
Posts: 654
Thanks: 0
Thanked 0 Times in 0 Posts
andy_jacko is an unknown quantity at this point
  php and mysql search

I have a php page that searches a database from a form.

my problem is that the results are a little obscure
i.e. if i search for car i get results with the word carry in them.

the search is on a description so I cant have = car.

any suggestions

regards andy
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 11-09-04
Retail-Therapy's Avatar
Can't Touch This
 
Join Date: May 2004
Location: КРОМИДОВО
Posts: 314
Thanks: 1
Thanked 0 Times in 0 Posts
Retail-Therapy is an unknown quantity at this point
if you don't want to, or haven't set up a fulltext index on your description field, try adding spaces to the beginning and the end of the search term;

WHERE description LIKE '% searchterm %'

the best method is to create a fulltext index on your description field, then search by a pattern match;

"SELECT *, MATCH(description) AGAINST ('searchterm') AS score FROM product where MATCH(description) AGAINST ('searchterm') group by score desc"
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 12-09-04
andy_jacko's Avatar
curiouser and curiouser
 
Join Date: Sep 2003
Location: uk
Posts: 654
Thanks: 0
Thanked 0 Times in 0 Posts
andy_jacko is an unknown quantity at this point
cheers for that,

im ashamed to admit it but i use dreamweaver (im currently learning php (im on lesson 4 of sams teach yourself) but i can do so minor editing.

I currently have:

"" mysql_select_db($database_sendto, $sendto);
$query_Recordset1 = sprintf("SELECT * FROM sendto WHERE description LIKE '%%%s%%'", $colname_Recordset1);
...................""

the ........ is query limits etc.

how would i edit this to use full text search (which is on the column description).

Kind regards andy
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 12-09-04
Retail-Therapy's Avatar
Can't Touch This
 
Join Date: May 2004
Location: КРОМИДОВО
Posts: 314
Thanks: 1
Thanked 0 Times in 0 Posts
Retail-Therapy is an unknown quantity at this point
The Query:

SELECT * FROM sendto WHERE description LIKE '%%%s%%'

To run it as a fulltext query, you need to replace that SELECT statement with this one:

SELECT *, MATCH(description) AGAINST ('SEARCHVARIABLE') AS score FROM sendto where MATCH(description) AGAINST ('SEARCHVARIABLE') group by score desc

SEARCHVARIABLE = Whatever you want it to, a word, or a passed variable.

Tony

Dreamweaver is the sharpest tool in my box!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 13-09-04
andy_jacko's Avatar
curiouser and curiouser
 
Join Date: Sep 2003
Location: uk
Posts: 654
Thanks: 0
Thanked 0 Times in 0 Posts
andy_jacko is an unknown quantity at this point
*edit*

thought i had it sorted but now it seems to only bring the same 19 unrealated results.?


any ideas

regards andy

Last edited by andy_jacko; 13-09-04 at 07:51 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 13-09-04
andy_jacko's Avatar
curiouser and curiouser
 
Join Date: Sep 2003
Location: uk
Posts: 654
Thanks: 0
Thanked 0 Times in 0 Posts
andy_jacko is an unknown quantity at this point
in phpmy admin i have

"Error
The additional Features for working with linked Tables have been deactivated. To find out why click here. "

at the bottom and if i "Click here". i get.

$cfg['Servers'][$i]['pmadb'] string
Starting with version 2.3.0 phpMyAdmin offers a lot of features to work with master / foreign - tables. To use those as well as the bookmark feature you need special tables with a predefined structure, which we explain below.
If you are the only user of this phpMyAdmin installation, you can use your current database to store those special tables; in this case, just put your current database name in $cfg['Servers'][$i]['pmadb'].

If you are setting up a multi-user phpMyAdmin installation, you will need to create a new database and setup special privileges, so, as superuser:


create a new database for phpMyAdmin:
CREATE DATABASE phpmyadmin;
Note that "controluser" must have SELECT, INSERT, UPDATE and DELETE privileges on this database. Here is a query to set up those privileges (using "phpmyadmin" as the database name, and "pma" as the controluser):
GRANT SELECT,INSERT,UPDATE,DELETE ON phpmyadmin.* to 'pma'@'localhost';
do not give any other user rights on this database.
enter the database name in $cfg['Servers'][$i]['pmadb']


Im guessing this is a host problem so i contacted them.

any other suggestions i coul try(im on shared hosting)


kind regards andy
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 13-09-04
Retail-Therapy's Avatar
Can't Touch This
 
Join Date: May 2004
Location: КРОМИДОВО
Posts: 314
Thanks: 1
Thanked 0 Times in 0 Posts
Retail-Therapy is an unknown quantity at this point
Andy, without the rest of your query line, I can't tell whats going wrong, if you want to pm me the whole database connection, query and result code, then I can see whats wrong.

The phpmyadmin stuff isn't relevant for whats happening to this query

Tony
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Affiliate Marketing RSS Feeds - Contact Us - Affiliate Marketing - Archive - Privacy Statement - Top

Content Relevant URLs by vBSEO 3.2.0 RC7