Page 1 of 1

Show all that BEGIN with specific letter

Posted: Fri Mar 19, 2004 5:33 pm
by palmere
Hey guys, I'm a complete newbie to this forum and somewhat of a newbie to php all together. I'm wondering (and I'm sure there is) some easy way to display all the entries that BEGIN with a specific letter.

In my case, I have a database that has artist names in it, and I want to be able to create a dynamic page that lists all artists that begin with a, b, and so on.

Thanks much.

Posted: Fri Mar 19, 2004 5:46 pm
by timvw
2 ways:

Make use of like and %

Make use of substring

Posted: Fri Mar 19, 2004 5:56 pm
by Illusionist

Code: Select all

$letter = "a";
$sql = "SELECT name FROM Artists WHERE name LIKE '$letter%'";

Posted: Wed Apr 07, 2004 5:05 pm
by palmere
Well, I posted this question a long time ago before I left on vacation expecting that someone would eventually get back to me...

little did i know that there would be 2 replies in a couple minutes of my post. Thanks a ton guys. Got it figured out.

E

Posted: Wed Apr 07, 2004 5:24 pm
by patrikG
Good holiday then, I hope? ;)

Posted: Wed Apr 07, 2004 5:44 pm
by palmere
Heck yeah,

With skiing in Colorado, gambling and Vegas and camping in Utah, you can't go wrong.

E

Posted: Wed Apr 07, 2004 7:02 pm
by tim
eeeeh

last time I went skiing, I ended up with a sore buttox. :evil:

last time I went camping I didnt catch any fish, when my buddies caught the mininum of 4 :evil:

grr! lol... Fun though none the less :roll:

Posted: Thu Apr 08, 2004 2:45 am
by patrikG
You must be grateful you haven't been gambling, tim ;)

Posted: Thu Apr 08, 2004 4:26 pm
by tim
patrikG wrote:You must be grateful you haven't been gambling, tim ;)
On the contrary, i been known to wipe out some peoples pockets when it comes to the ole poker ride. Hence why i'm usually not welcomed to play =]