Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old October 6th, 2008, 10:25 PM
--~AngelisIIDX~--
Guest
 
Posts: n/a
Default Need help with a search code.

Hey ya guys. Just a pre thank you for any help or info.

Basically here is what is going on. I have a search engine I've been working
on and as of right now it is working with multiple key words. The problem
I'm having is that when you enter a search term it will bounce back
everything for each key word and not comparing them. I honestly don't know
how to do this, being new to the whole PHP/SQL.

This is what I'm using right now for the mysql string to search:
$result = mysql_query("SELECT * FROM ptvideos2 WHERE search LIKE
'%$search_words[$i]%' ");

any ideas?

  #2  
Old October 7th, 2008, 02:15 AM
Jerry Stuckle
Guest
 
Posts: n/a
Default Re: Need help with a search code.

--~AngelisIIDX~-- wrote:
Quote:
Hey ya guys. Just a pre thank you for any help or info.
>
Basically here is what is going on. I have a search engine I've been
working on and as of right now it is working with multiple key words.
The problem I'm having is that when you enter a search term it will
bounce back everything for each key word and not comparing them. I
honestly don't know how to do this, being new to the whole PHP/SQL.
>
This is what I'm using right now for the mysql string to search:
$result = mysql_query("SELECT * FROM ptvideos2 WHERE search LIKE
'%$search_words[$i]%' ");
>
any ideas?
>
I suggest you ask SQL questions in comp.databases.mysql. You'll get
better help over there.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

  #3  
Old October 7th, 2008, 07:35 AM
robert stearns
Guest
 
Posts: n/a
Default Re: Need help with a search code.

--~AngelisIIDX~-- wrote:
Quote:
Hey ya guys. Just a pre thank you for any help or info.
>
Basically here is what is going on. I have a search engine I've been
working on and as of right now it is working with multiple key words.
The problem I'm having is that when you enter a search term it will
bounce back everything for each key word and not comparing them. I
honestly don't know how to do this, being new to the whole PHP/SQL.
>
This is what I'm using right now for the mysql string to search:
$result = mysql_query("SELECT * FROM ptvideos2 WHERE search LIKE
'%$search_words[$i]%' ");
>
any ideas?
what you probably want is something like:
$sql = "SELECT * FROM ptvideos2 WHERE ";
$oper = "";
foreach( $search_words, $aword) {
$sql = $sql . "search LIKE %" . $aword . "%" . $oper;
$oper = " AND ";
}
$result = mysql_query($sql);

But boy is this going to be slow on any appreciable sized db. Do a
google search on text searching or inverted indexes.

PS This is untested code, off the top of my head. Test extensively
before using.
  #4  
Old October 7th, 2008, 01:45 PM
salmobytes
Guest
 
Posts: n/a
Default Re: Need help with a search code.

--~AngelisIIDX~-- wrote:
Quote:
I have a search engine I've been
working on and
any ideas?
Google hyperestraier
  #5  
Old October 8th, 2008, 05:05 PM
Betikci Boris
Guest
 
Posts: n/a
Default Re: Need help with a search code.

On Oct 7, 12:19*am, "--~AngelisIIDX~--" <fwrote:
Quote:
Hey ya guys. Just a pre thank you for any help or info.
>
Basically here is what is going on. I have a search engine I've been working
on and as of right now it is working with multiple key words. The problem
I'm having is that when you enter a search term it will bounce back
everything for each key word and not comparing them. I honestly don't know
how to do this, being new to the whole PHP/SQL.
>
This is what I'm using right now for the mysql string to search:
$result = mysql_query("SELECT * FROM ptvideos2 WHERE search LIKE
'%$search_words[$i]%' ");
>
any ideas?
You have to fetch almost everything from database, and have to process
it according to your algorythm. I suggest use Php Data Objects - PDO -
class, processing become much easier.
 

Bookmarks

Thread Tools

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 Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles