示例#1
0
function renderMatches($qualifier, $quality, $type, $exact)
{
    global $mysql;
    global $DIALECT;
    global $SYNTAX_CLASS_FULL;
    $search_mode = true;
    #Used to make related words open in new windows.
    $operator = 'LIKE';
    if ($exact) {
        $operator = '=';
    }
    $stmt = $mysql->prepare('SELECT word, meaning, japanese, kana, dialect, romaji, description, class FROM hymmnos WHERE ' . $qualifier . ' ' . $operator . ' ? ORDER BY dialect ASC');
    $stmt->bind_param('s', $quality);
    $stmt->execute();
    $stmt->store_result();
    $matched = $stmt->num_rows > 0;
    if ($matched) {
        #There are results to display.
        $plural = '';
        if ($stmt->num_rows != 1) {
            $plural = 's';
        }
        echo '<div style="padding-bottom: 10px;">';
        echo '<span style="color: red; font-weight: bold;">' . $type . ' (' . $stmt->num_rows . ' record' . $plural . ')</span>';
        echo '<div style="padding-left: 13px;">';
        $stmt->bind_result($word, $meaning, $japanese, $kana, $dialect, $romaji, $notes, $class);
        include_once 'common/word.php';
        while ($stmt->fetch()) {
            #Display every result.
            #Read all related words from the database.
            $stmt2 = $mysql->prepare('SELECT destination, destination_dialect FROM hymmnos_mapping WHERE source = ? AND source_dialect = ? ORDER BY destination ASC, destination_dialect ASC');
            $stmt2->bind_param('si', $word, $dialect);
            $stmt2->execute();
            $stmt2->store_result();
            $links = array();
            $stmt2->bind_result($link, $link_dialect);
            while ($stmt2->fetch()) {
                $links[] = array($link, $link_dialect);
            }
            $stmt2->free_result();
            $stmt2->close();
            renderWord($word, $class, $meaning, $romaji, $japanese, $kana, $dialect, $notes, $links);
        }
        echo '</div>';
        echo '</div>';
    }
    $stmt->free_result();
    $stmt->close();
    return $matched;
}
示例#2
0
$stmt->execute();
$stmt->store_result();
if ($stmt->num_rows != 1) {
    die('Unknown word specified');
}
$stmt->bind_result($word, $meaning, $japanese, $kana, $dialect, $romaji, $notes, $class);
$stmt->fetch();
$stmt->free_result();
$stmt->close();
//Read all related words from the database.
$stmt = $mysql->prepare('SELECT destination, destination_dialect FROM hymmnos_mapping WHERE source = ? AND source_dialect = ? ORDER BY destination ASC, destination_dialect ASC');
$stmt->bind_param('si', $word, $dialect);
$stmt->execute();
$stmt->store_result();
$links = array();
$stmt->bind_result($link, $link_dialect);
while ($stmt->fetch()) {
    $links[] = array($link, $link_dialect);
}
$stmt->free_result();
$stmt->close();
$mysql->close();
include 'common/word.php';
renderWord($word, $class, $meaning, $romaji, $japanese, $kana, $dialect, $notes, $links);
$footer_word = true;
include 'common/footer.xml';
?>
 
	</body>
</html>
示例#3
0
function renderWords($words)
{
    $alternatives = array();
    foreach ($words as $word) {
        if (renderWord($word)) {
            $word_c = $word[0];
            if (!in_array($word_c, $alternatives)) {
                $alternatives[] = $word_c;
            }
        }
    }
    return $alternatives;
}