32
I borrowed a search funtion from 'news' I think it was, to myGuestbook searchable. I have two issues with it, beside trying to figure out what to display in the 'link', In general it doesn't seem to find the search word(s). I've turned on the php Debug, and after fixing a php script error message, it seems to work (ie when searching the function is called) yet it never produces results.
(yes I've added it to the xoops_version file)
below is the function:
function mission_search($queryarray, $andor, $limit, $offset, $userid){
global $xoopsDB;
$sql = "SELECT id,name,title,message, time FROM ".$xoopsDB->prefix("myguestbook")."";
if ( is_array($queryarray) && $count = count($queryarray) ) {
$sql .= " AND ((name LIKE '%$queryarray[0]%' OR title LIKE '%$queryarray[0]%' OR message LIKE '%$queryarray[0]%')";
for($i=1;$i<$count;$i++){
$sql .= " $andor ";
$sql .= "(name LIKE '%$queryarray[$i]%' OR title LIKE '%$queryarray[$i]%' OR message LIKE '%$queryarray[$i]%')";
}
$sql .= ") ";
}
$sql .= "ORDER BY id DESC";
$result = $xoopsDB->query($sql,$limit,$offset);
$ret = array();
$i = 0;
while($myrow = $xoopsDB->fetchArray($result)){
// $ret[$i]['image'] = "images/forum.gif";
$ret[$i]['link'] = "index.php?start=0";
$ret[$i]['title'] = $myrow['title'];
$ret[$i]['time'] = $myrow['time'];
$i++;
}
return $ret;
}
?>
thanks for help in advance, krayc