6
function mylinks_search($queryarray, $andor, $limit, $offset, $userid){
global $xoopsDB;
$sql = "SELECT l.lid,l.cid,l.title,l.submitter,l.date,t.description FROM ".$xoopsDB->prefix("mylinks_links")." l LEFT JOIN ".$xoopsDB->prefix("mylinks_text")." t ON t.lid=l.lid WHERE status>0";
if ( $userid != 0 ) {
$sql .= " AND l.submitter=".$userid." ";
}
// because count() returns 1 even if a supplied variable
// is not an array, we must check if $querryarray is really an array
if ( is_array($queryarray) && $count = count($queryarray) ) {
$sql .= " AND ((l.title LIKE '%$queryarray[0]%' OR description LIKE '%$queryarray[0]%' OR submitter LIKE '%$queryarray[0]%')";
for($i=1;$i<$count;$i++){
$sql .= " $andor ";
$sql .= "(title LIKE '%$queryarray[$i]%' OR description LIKE '%$queryarray[$i]%' OR submitter LIKE '%$queryarray[$i]%')";
}
$sql .= ") ";
}
$sql .= "ORDER BY l.date DESC";
ob_start();
$result = $xoopsDB->query($sql,$limit,$offset);
$ret = array();
$i = 0;
while($myrow = $xoopsDB->fetchArray($result)){
$ret[$i]['image'] = "images/home.gif";
$ret[$i]['link'] = "singlelink.php?cid=".$myrow['cid']."&lid=".$myrow['lid']."";
$ret[$i]['title'] = $myrow['title'];
$ret[$i]['lid'] = $myrow['lid'];
$ret[$i]['time'] = $myrow['date'];
$ret[$i]['uid'] = $myrow['submitter'];
$i++;
}
$out1 = ob_get_contents();
ob_end_clean();
$renkdegistir = "red">".$i."";
echo str_replace ($i,$renkdegistir,$out1);
return $ret;
}
i made these changes in modules/mylinks/include/search.inc.php
but query has't worked on as red.
where is my mistake??