Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

The Database Forum


You are currently viewing our The Database Forum as a guest. Please register to participate.
Login



Reply
To display table order in reverse?
Old 04-05-2007, 11:16 AM To display table order in reverse?
Sydpix's Avatar
Drinker I Smoke

Posts: 424
Name: Denny
Location: In a can...
Trades: 0
I connect to MySql to return property values <?= $Home["id"] ?>

How can I get it to display in reverse order.

Any Ideas?

Thanks
__________________
.
Village Idiot

Sydpix is offline
Reply With Quote
View Public Profile Visit Sydpix's homepage!
 
 
Register now for full access!
Old 04-05-2007, 11:39 AM Re: To display table order in reverse?
Experienced Talker

Posts: 46
Trades: 0
In your query put
ORDER BY DESC

ASC = Ascending
DESC = Descending

Last edited by bld44; 04-05-2007 at 11:42 AM..
bld44 is offline
Reply With Quote
View Public Profile
 
Old 04-05-2007, 12:11 PM Re: To display table order in reverse?
Sydpix's Avatar
Drinker I Smoke

Posts: 424
Name: Denny
Location: In a can...
Trades: 0
Interesting this isn't working.

I added ORDER BY Id DESC. It changes the order in phpMyAdmin but it didn't change it on the site. ??

Code:
<?
$connection = mysql_connect($Host, $UserName, $PassWord);
mysql_select_db($DataBase);
if($lang == "f")
   $Select = "Select homes.id, type_f as type, short_description_f as short_description, description_f as description, " . 
             "location_f as location, address_f as address, rented, sold " . 
             "from homes, market where homes.id = market.home_id and rented = 1";
else
   $Select = "Select homes.id, type_e as type, short_description_e as short_description, description_e as description, " . 
             "location_e as location, address_e as address, rented, sold " . 
             "from homes, market where homes.id = market.home_id and rented = 1";
$Homes = mysql_query($Select);
?>
And

Code:
  <?
$Counter = 0;
while($Home = mysql_fetch_assoc($Homes)) {
?>
Maybe it's in this code somewhere?


Or maybe I need to add multiple columns?

SELECT "column_name"
FROM "table_name"
[WHERE "condition"]
ORDER BY "column_name" [ASC, DESC]


Sorry for the noob question
__________________
.
Village Idiot


Last edited by Sydpix; 04-05-2007 at 12:16 PM..
Sydpix is offline
Reply With Quote
View Public Profile Visit Sydpix's homepage!
 
Old 04-05-2007, 12:17 PM Re: To display table order in reverse?
Experienced Talker

Posts: 46
Trades: 0
You need to add it in the php query, not phpMyAdmin.

Needs to be something like this:

Quote:
$Select = "Select homes.id, type_f as type, short_description_f as short_description, description_f as description, " .
"location_f as location, address_f as address, rented, sold " .
"from homes, market where homes.id = market.home_id and rented = 1 ORDER BY id DESC";
bld44 is offline
Reply With Quote
View Public Profile
 
Old 04-05-2007, 12:20 PM Re: To display table order in reverse?
Sydpix's Avatar
Drinker I Smoke

Posts: 424
Name: Denny
Location: In a can...
Trades: 0
Beautiful !! Thank You very much.

I need to get up to speed with SQL for sure...
__________________
.
Village Idiot

Sydpix is offline
Reply With Quote
View Public Profile Visit Sydpix's homepage!
 
Old 04-05-2007, 01:24 PM Re: To display table order in reverse?
Experienced Talker

Posts: 46
Trades: 0
No problem. Hopefully that will work for you.
bld44 is offline
Reply With Quote
View Public Profile
 
Old 04-06-2007, 01:03 AM Re: To display table order in reverse?
Smaaz's Avatar
Experienced Talker

Posts: 41
Trades: 0
You can use simple query like

select name from table order by name desc

thanks
__________________

Please login or register to view this content. Registration is FREE
~~
Please login or register to view this content. Registration is FREE
~~
Please login or register to view this content. Registration is FREE
~~
Please login or register to view this content. Registration is FREE
Smaaz is offline
Reply With Quote
View Public Profile Visit Smaaz's homepage!
 
Reply     « Reply to To display table order in reverse?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.26705 seconds with 12 queries