2 Orders in Query

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

2 Orders in Query

Post by John Cartwright »

I've done this before but I'm sorta stumped on how to do it again.

Code: Select all

<?php
$result = @mysql_query("SELECT * FROM portfolio WHERE type='$section' ORDER BY `type`,`id` DESC"); 
?>
That gives parse error, HELP?
?????????????????
TheBentinel.com
Forum Contributor
Posts: 282
Joined: Wed Mar 10, 2004 1:52 pm
Location: Columbus, Ohio

Re: 2 Orders in Query

Post by TheBentinel.com »

Phenom wrote:I've done this before but I'm sorta stumped on how to do it again.

Code: Select all

<?php
$result = @mysql_query("SELECT * FROM portfolio WHERE type='$section' ORDER BY `type`,`id` DESC"); 
?>
That gives parse error, HELP?
?????????????????
I don't think you want quotes around the type and id:

Code: Select all

<?php
$result = @mysql_query("SELECT * FROM portfolio WHERE type='$section' ORDER BY type, id DESC"); 
?>
Does that help?
Post Reply