这是我上一个问题的跟进问题。我想编写一条MYSQL语句,以回显以字母B开头的每个条目。
Function.php
function getCategory() { $query = mysql_query("SELECT author FROM lyrics WHERE author [starts with letter B]") or die(mysql_error()); while ($row = mysql_fetch_assoc($query)) { ?> <p><a href="##"><?= $row['author']; ?></a></p> <?php }
Category.php?category = b
<?php include 'includes/header.php' ?> <?php getCategory(); ?> <?php include 'includes/footer.php' ?>
我猜就是那样。然后每个字母一个,另一个带杂项(数字等)
SELECT author FROM lyrics WHERE author LIKE 'B%';
不过,请确保在上有一个索引author!
author