|
|
|
|
![]() ![]() |
Mar 10 2008, 05:56 PM
Post
#1
|
|
|
Super Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: [HOSTED] Posts: 397 Joined: 9-February 08 Member No.: 57,615 |
How do people make categories like the ones on the musical portals that look like ABC. The user just click the letter and then he got the list of available songs for this artists, if you know, please, let me know as well.
|
|
|
|
Mar 10 2008, 06:26 PM
Post
#2
|
|
|
Define:EVIL PROGRAMMER (ē'vəl prō'grăm'ər)- n. An organism that converts caffeine into evil software. ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: [HOSTED] Posts: 1,074 Joined: 25-September 05 From: Los Angeles, California Member No.: 12,251 |
Well if you are using sql to store all of these results, you can find all of those that start with a certain letter with this sql code:
SQL SELECT * FROM [tablename] WHERE [fieldname] LIKE '[letter]%' So your php code would look something like this: CODE $result=mysql_query("SELECT * FROM songs WHERE name LIKE '".$_GET['letter']."%'");
for($i=0;$i<mysql_num_rows($result);$i++)echo mysql_result($result,$i,"name"); |
|
|
|
Mar 11 2008, 10:55 AM
Post
#3
|
|
|
Super Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: [HOSTED] Posts: 397 Joined: 9-February 08 Member No.: 57,615 |
So, you mean in the table itself, I need create kind of alphabet (A-Z), then create PHP Code as well as Query, to show the songs I got from that letter.
|
|
|
|
Mar 11 2008, 01:31 PM
Post
#4
|
|
|
Ephesians 6:10-17 ![]() Group: [MODERATOR] Posts: 1,917 Joined: 22-June 05 From: The World of Gentoo Member No.: 8,528 |
So, you mean in the table itself, I need create kind of alphabet (A-Z), then create PHP Code as well as Query, to show the songs I got from that letter. Basically you should have a table named "artists," with at least three columns (to keep it simple): id, name, songs. We'll assume you know how to make a MySQL database, table, etc. The code provided by alex7h3pr0gr4m3r just searches the table column "name" for the specified syntax in that table. alex7h3pr0gr4m3r's code assumes that you would use the GET method for the pagination (which is common for things like this). In the page where you want the names that the MySQL query picked up, place that code in. |
|
|
|
Mar 11 2008, 02:27 PM
Post
#5
|
|
|
Super Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: [HOSTED] Posts: 397 Joined: 9-February 08 Member No.: 57,615 |
Thanks, it's clear! I got it.
|
|
|
|
![]() ![]() |
Similar Topics
| Topics | Topics | |
|---|---|---|
|
|
|
|
Lo-Fi Version | Time is now: 11th October 2008 - 08:35 PM |