Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

fetch rows from mysql in order by first two alphabets

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

fetch rows from mysql in order by first two alphabets

Postby developerahusain » 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.

Ahamed
Asamed
Buddy
Byddy

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

Re: fetch rows from mysql in order by first two alphabets

Postby pbs » Fri May 31, 2013 3:04 am

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

Re: fetch rows from mysql in order by first two alphabets

Postby johnj » Fri May 31, 2013 7:55 am

use the order by clause in your sql.
johnj
php-forum Super User
php-forum Super User
 
Posts: 1805
Joined: Thu Mar 10, 2011 5:07 pm

Re: fetch rows from mysql in order by first two alphabets

Postby johnmacd » 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.
johnmacd
New php-forum User
New php-forum User
 
Posts: 19
Joined: Wed Jun 12, 2013 9:30 pm


Return to PHP coding => General

Who is online

Users browsing this forum: Baidu [Spider] and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron