this is tormenting me for days already.....
i downloaded this script
http://www.digitalgenesis.com/software/dgssearch
and because the author does not answer my mails, i hope someone of you will point me at least a direction.......
here is the situation
i'm using it to search mysql database with info for movies
on the result page it outputs
$database[0]['link']
$database[0]['link']
$database[0]['desc']
the problem is that not always it shows the data in $database[0]['desc']
i noticed that it shows it only when there is the searched word, but if the searched word is only in $database[0]['link'] or $database[0]['link'] it shows only them, without $database[0]['desc']
i need database[0]['desc'] to be shown always, regardless there is the searched word
i'm exploring the code, tried different things but without success
i guess that the problem is somewhere, in this part but my knowledges aren't enough to fix it
if ($matchCount < $o || $matchCount > $r + $o) { //Only build the desc if we need them.
$retVal[] = array(0); //Place holder, since this is outside of the displayed results.
} else {
$link = $db['link'];
$url = $db['url'];
$descArray = $db['desc'];
$descWidth = $db['descWidth'];
$rfields = $db['returnField'];
$i = 0;
if (!is_array($descArray))
$descArray = array();
reset($rfields);
while (list(, $field) = each($rfields)) {
$matchField = trim($match[$field]);
$var = sprintf('@%d@', $i);
$link = str_replace($var, $matchField, $link);
$url = str_replace($var, $matchField, $url);
reset($descArray);
while (list($idx, $desc) = each($descArray)) {
$descArray[$idx] = str_replace($var, $matchField, $desc);
}
$i++;
}
if ($descWidth > 0) {
reset($descArray);
while (list($idx, $desc) = each($descArray)) {
$desc = processWindow($desc, $descWidth, 1, $q, $matchCount);
$descArray[$idx] = $desc[0]; /* processWindow() sets the index to 0 for the first item. */
}
}
$retVal[] = array('link' => $link, 'url' => $url, 'description' => $descArray, 'source' => 'db');
}
this is part of the code of db.php