Поиск по ключевому слову
Ключ поиска:
"; if( isset( $keyword ) ) { $keyword = trim( $keyword ); if( strlen( $keyword ) == 1 ) $keyword = ""; if( $keyword != "" ) { dbConnect(); $result = mysql_query( "SELECT rootID, parentID, topic, name, time, msg FROM $forum_table WHERE topic LIKE '%$keyword%' || msg LIKE '%$keyword%' || name LIKE '%$keyword%' ORDER BY time DESC" ); $foundNum = mysql_num_rows( $result ); $keyword = stripslashes( $keyword ); echo "
"; $i = 1; while( $row = mysql_fetch_array( $result ) ) { if( $row[ 'parentID' ] == 0 ) $id = "{$row[ 'rootID' ]},{$row[ 'rootID' ]}"; else $id = findRootID( $row[ 'parentID' ] ) . ",{$row[ 'rootID' ]}"; $row[ 'topic' ] = eregi_replace( $keyword, "$keyword", $row[ 'topic' ] ); $row[ 'msg' ] = eregi_replace( $keyword, "$keyword", $row[ 'msg' ] ); $row[ 'name' ] = eregi_replace( $keyword, "$keyword", $row[ 'name' ] ); echo " "; $i++; } echo "
Найдено $foundNum по ключу '$keyword'
$i. {$row[ 'topic' ]} | От: {$row[ 'name' ]} [" . strftime( "%c", $row[ 'time' ] ) . "]
  {$row[ 'msg' ]}
"; } } echo "

[Список дискуссий] [Назад]

"; displayFooter(); function findRootID( $parentID ) { global $forum_table; $result = mysql_query( "SELECT rootID, parentID FROM $forum_table WHERE rootID=$parentID" ); if( !$result ) { return $parentID; exit; } $row = mysql_fetch_row( $result ); findRootID( $row[ 1 ] ); return $row[ 0 ]; } ?>