Go Back   Free website templates > Web Template Help > PHP and MySQL
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read


Join now to download all the free website templates or post on the forum. If you have never been on a forum before read the FAQ. It's quick, easy and free to join!
Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-14-2009, 12:46 AM
bmcoll3278's Avatar
Moderator
 
Join Date: Jun 2009
Posts: 294
bmcoll3278 is on a distinguished road
Default I need sql help

hey guys here is my query string
mysql_query("SELECT * FROM names WHERE name like '%A%';ORDER BY name ASC");

This Table row contains a single word name My query works but it will pull all names with a (a) in them. Can someone tell me how to match only the first letter of the name so I can display all names with a or b or c you get the idea.

Thanks in advance
__________________
I hope to build a site with something for every body
www.bmcoll.com
Reply With Quote
  #2 (permalink)  
Old 08-14-2009, 01:08 AM
ishkey's Avatar
Moderator
 
Join Date: Aug 2007
Location: North GA USA
Posts: 1,360
ishkey will become famous soon enough
Default

"ORDER BY Keyword"
The ORDER BY keyword sort the records in ascending order by default.
If you want to sort the records in a descending order, you can use the DESC keyword.

SELECT column_name(s)
FROM table_name
ORDER BY column_name(s) ASC|DESC
__________________
RIF= Reading Is Fun - Understanding Funner
cleandeck - lawn mower undercoating and wilmargraphite - graphite lubricants
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 10:52 AM.



mouseover mouseover mouseover