Page 1 of 1

sorting alphabatically

Posted: Tue Jun 03, 2008 8:43 am
by Amit Mehta
hi,

in my web page i want look like this.

A B C D E F G H i j k l m n o p q r s t u v w x y z show all

that means alphabetic sort when i click on "a" then only select that topic which are start with "a". and also want how to display above string (A - Z). and fetching data from data base table.

pls reply.

Thanks.

Re: sorting alphabatically

Posted: Tue Jun 03, 2008 9:44 am
by pickle
This is called "paging". Search for it both on these boards & Google.

Re: sorting alphabatically

Posted: Tue Jun 03, 2008 3:36 pm
by kryles

Code: Select all

 
 
<a href="urpage.com/script.php?sort=a">a</a>
<a href="urpage.com/script.php?sort=b">b</a>
 
 

Code: Select all

 
 
$selector = mysql_real_escape_string(trim(strip_tags($_GET['sort'])));
 
$query = "SELECT topicTitle
              FROM topicTable
              WHERE TopicTitle LIKE '".$selector."%'";
$result = mysql_fetch_row($query) or print(mysql_error());
 
while($row = mysql_fetch_row($result))
{
/* list topics here */
echo $row[0]."<br />";
}
 
 
hopefully that gives you some idea