Jul 26, 2008

Php Pagination With Letters? - A,B,C...

Free Web Hosting, No Ads > CONTRIBUTE > Computers > Programming Languages > PHP Programming

free web hosting

Php Pagination With Letters? - A,B,C...

alex1985
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.

Reply

galexcd
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");

Reply

alex1985
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.

Reply

truefusion
QUOTE(alex1985 @ Mar 11 2008, 06:55 AM) *
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.

Reply

alex1985
Thanks, it's clear! I got it.

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Similar Topics

Keywords : php pagination letters

  1. Pagination - (8)



Looking for php, pagination, letters,

Searching Video's for php, pagination, letters,
advertisement



Php Pagination With Letters? - A,B,C...



 

 

 

 

ADD REPLY / Got an Opinion! Remove these ADs! RAPID SEARCH! Free Web Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE