fetch rows from mysql in order by first two alphabets

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
New php-forum User
New php-forum User
Posts: 44
Joined: Tue May 28, 2013 10:04 pm
Location: India,Lucknow

Fri May 31, 2013 2:51 am

How to fetch content sorted by first two alpabhets using php. For example

I have two names Ahamed, Asamed,Buddy,Byddy in mysql table. I want to fetch this content in alphabetic order like this in php.


Any suggestions

New php-forum User
New php-forum User
Posts: 53
Joined: Sat May 11, 2013 1:40 am
Location: Nashik, India

Fri May 31, 2013 3:04 am

php-forum Super User
php-forum Super User
Posts: 1803
Joined: Thu Mar 10, 2011 5:07 pm

Fri May 31, 2013 7:55 am

use the order by clause in your sql.

New php-forum User
New php-forum User
Posts: 72
Joined: Wed Jun 12, 2013 9:30 pm

Thu Jun 13, 2013 10:46 pm

use query SELECT * FROM pet WHERE name LIKE 'b%'; if u want records starting with b.OR you can use order by clause.

Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 2 guests