array problem
| From: | Michael Geier | Date: | Mon, 13 Nov 2000 16:53:22 +0000 |
| Subject: | array problem | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-24976@lists.php.net to get a copy of this message | ||
I am trying to create a weighted search routine against a mysql db.
I explode my search criteria and search against each word currently (I
realize that complete phrases should weight higher; worry about that later).
While ($searchphrase = mysql_shift($exploded_criteria)) {
$result = query("select FIELDS from TABLE where MEMOFIELD like
'%$searchphrase%'",$db);
// how do I combine this array with results from previous/future queries?
}
ie. (fictional data/results)
searching for "my dog spot"
select rowid,memo from TABLE where MEMOFIELD like '%my%' (returns 2 rows)
select rowid,memo from TABLE where MEMOFIELD like '%dog%' (returns 14
rows)
select rowid,memo from TABLE where MEMOFIELD like '%spot%' (returns 1 row)
merge arrays
newarray (17 x 2) (rowid, memo)
Any hints?
Thanks.
Michael Geier
mgeier@cdmsports.com