The Daily Static
  The Daily Static
UF Archives
Register
UF Membership
Ad Free Site
Postcards
Community

Geekfinder
UFie Gear
Advertise on UF

Forum Rules
& FAQ


Username

Password


Create a New Account

 
 

Back to UserFriendly Strip Comments Index

here I go again with php & mysql =) by resc2007-02-16 00:43:35
  That depends on the field / column by EnzoMatrix 2007-02-16 01:05:40
In case of numerical values, for example the id, use

 SELECT * FROM $dbtbl ORDER BY id ASC; 


This will get the list of rows sort by id going up. if you now want the list the other way around, use 'ORDER BY id DESC'. ASC stands for 'Ascending' where DESC stands for 'Descending'.

In the case of letters.. This is a bit more difficult.. You'll want to use the MySQL statement 'LIKE'. This is a tool in MySQL to compare strings to strings in fields.

Basically it functions like:
SELECT * FROM $dbtbl WHERE column_name LIKE 'foo';

I tend to evade these constructions though, and go for the ORDER BY technique whereever I can.
[ Reply ]
    LIKE has nothing to do with ordering by sazzer2007-02-16 01:56:44

 

[Todays Cartoon Discussion] [News Index]

Come get yer ARS (Account Registration System) Source Code here!
All images, characters, content and text are copyrighted and trademarks of J.D. Frazer except where other ownership applies. Don't do bad things, we have lawyers.
UserFriendly.Org and its operators are not liable for comments or content posted by its visitors, and will cheerfully assist the lawful authorities in hunting down script-kiddies, spammers and other net scum. And if you're really bad, we'll call your mom. (We're not kidding, we've done it before.)