ich würde die bestehende Suchfunktion gerne auf den Kalender ausweiten, weiß aber nicht, wie ich da am besten rangehe. Ich hab die search.php erweitert (hier ab Zeile 118, Veränderungen mit NEU markiert):
$serar = explode(' ', $such);
$str_forum = '';
$str_news = '';
$str_downs = '';
$str_kal = ''; <------NEU
foreach($serar as $v) {
$str = str_replace('\'','',$v);
$str = str_replace('"','',$str);
$str = addslashes($str);
if ( !empty($str) ) {
$str_forum .= "txt LIKE '%".$str."%' AND ";
$str_news .= "news_text LIKE '%".$str."%' AND ";
$str_downs .= "`descl` LIKE '%".$str."%' AND ";
$str_kal .= "text LIKE '%".$str."%' AND "; <----NEU
}
}
$q = "(
SELECT DISTINCT
0 as fid,
news_title as titel,
'news' as typ,
news_id as id,
news_time as time
FROM prefix_news
WHERE (".$str_news." 1 = 1)
AND (news_time >= ". $x .")
) UNION (
SELECT DISTINCT
prefix_topics.fid as fid,
prefix_topics.name as titel,
'foru' as typ,
prefix_topics.id as id,
time as time
FROM prefix_posts
LEFT JOIN prefix_topics ON prefix_topics.id = prefix_posts.tid
LEFT JOIN prefix_forums ON prefix_forums.id = prefix_topics.fid
WHERE (prefix_forums.view >= ".$_SESSION['authright']." OR prefix_forums.reply >= ".$_SESSION['authright']." OR prefix_forums.start >= ".$_SESSION['authright'].")
AND (".$str_forum." 1 = 1)
AND (time >= ". $x .")
GROUP BY prefix_topics.id
) UNION (
SELECT DISTINCT
0 as fid,
CONCAT( name, ' ', version ) AS titel,
'down' as typ,
id,
UNIX_TIMESTAMP(time) as time
FROM prefix_downloads
WHERE (".$str_downs." 1 = 1)
AND (time >= ". $x .")
) UNION (
SELECT DISTINCT <----NEU
0 as fid,
titel,
'kal' as typ,
id,
time,
FROM prefix_kalender
WHERE (".$str_kal." 1 = 1)
AND (time >= ". $x .")
)
ORDER BY time DESC";
$gAnz = db_num_rows(db_query($q));
}
$q .= " LIMIT ".$anfang.",".$limit;
$MPL = db_make_sites ($page , "" , $limit , "index.php?search=".urlencode($such)."&page=", "", $gAnz );
$tpl->set_ar_out(array('MPL'=>$MPL,'gAnz'=>$gAnz),1);
$q = db_query($q);
$class = '';
while($r = db_fetch_assoc($q) ) {
$class = ($class == 'Cmite' ? 'Cnorm' : 'Cmite' );
$r['class'] = $class;
if ($r['typ'] == 'foru') {
$r['ctime'] = db_result(db_query("SELECT MAX(time) FROM prefix_posts WHERE tid = ".$r['id']),0,0);
$r['ord'] = forum_get_ordner($r['ctime'],$r['id'],$r['fid']);
$r['link'] = 'forum-showposts-'.$r['id'];
} elseif ($r['typ'] == 'news') {
$r['ord'] = 'ord';
$r['link'] = 'news-'.$r['id'];
} elseif ($r['typ'] == 'down') {
$r['ord'] = 'ord';
$r['link'] = 'downloads-show-'.$r['id'];
} elseif ($r['typ'] == 'kal') { <---NEU
$r['ord'] = 'ord';
$r['link'] = 'kalender-v0-e'.$r['id'];
}
$tpl->set_ar_out($r,2);
}
$tpl->out(3);
}
$design->footer();
Scheint aber was falsch zu sein, denn er wirft mir Fehler aus, und zwar in ../htdocs/include/includes/func/db/mysql.php
in line 61 -->Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource
in line 44 -->Warning: mysql_result(): supplied argument is not a valid MySQL result resource
in line 48 -->Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource
jemand ne Idee für mich?
Ach ja, an den Tabellen hab ich nichts verändert und die Suche funktioniert einwandfrei in Forum und News und ich verwende die Version 1.1E


