Ejemplo n.º 1
0
    if (count($arr) == 0) {
        print "No books!\n";
    } else {
        print_r($arr);
    }
    print "<br>";
}
$letters = $db->getAuthorsFirstLetters();
print "<br><b>Authors First Letter:</b><br>";
if (count($letters) == 0) {
    print "No letters!\n";
} else {
    print_r($letters);
    print "<br><b>Authors:</b><br>";
    foreach ($letters as $l) {
        $authors = $db->getAuthorsByFirstLetter($l);
        if (count($authors) == 0) {
            print "No authors for '%l'!\n";
        } else {
            print_r($authors);
        }
        print "<br>";
    }
}
print "<br>";
for ($i = 0; $i < $COUNT; $i++) {
    $db->deleteBook("stkey{$i}");
}
?>
</body>
</html>
Ejemplo n.º 2
0
            } else {
                echo "<a href=\"library.php?letter={$l}\">{$l}</a> ";
            }
        } else {
            echo "{$l} ";
        }
    }
    echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
}
?>
            </div>
            <img src="images/green_px.gif" class="line"/>
            
            <!--  display authors --> 
            <?php 
$list = $db->getAuthorsByFirstLetter($letter);
if ($list) {
    $count = count($list);
    $MAX_COLS = 2;
    $MAX_ROWS = floor(($count + $MAX_COLS - 1) / $MAX_COLS);
    for ($col = $MAX_COLS - 1; $col >= 0; $col--) {
        if ($col == 0) {
            echo '<div class="left_book">';
        } else {
            echo '<div class="right_book">';
        }
        for ($row = 0; $row < $MAX_ROWS; $row++) {
            $i = $col * $MAX_ROWS + $row;
            echo "<p>";
            if ($i < $count) {
                $author = $list[$i]["author"];