选择[第一个字母以B开头]的所有位置 [英] Select all where [first letter starts with B]
本文介绍了选择[第一个字母以B开头]的所有位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我上一个问题的跟进问题.我想编写一条MYSQL语句,以回显以字母B开头的每个条目.
This is a follow up question to my previous one. I want to write a MYSQL statement that echoes every entry that starts with letter B.
Function.php
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
Category.php?category=b
<?php include 'includes/header.php' ?>
<?php getCategory(); ?>
<?php include 'includes/footer.php' ?>
就像我猜的那样.然后每个字母一个,另一个为misc(数字等)
Like that I guess. And then one for every letter of the alphabet, and one with misc (numbers etc)
推荐答案
SELECT author FROM lyrics WHERE author LIKE 'B%';
不过,请确保在author
上有索引!
Make sure you have an index on author
, though!
这篇关于选择[第一个字母以B开头]的所有位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文