Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.
Moderator: General Moderators
Zeceer
Forum Contributor
Posts: 136 Joined: Fri Aug 02, 2002 5:10 am
Location: Norway
Post
by Zeceer » Sat Sep 13, 2003 3:23 am
I've read the other post here about ORDER BY by it didn't help me much. I've also tried to look for code examples without any luck. Is there something wrong wih the syntax in this code?
Code: Select all
$result = mysql_query( "SELECT * FROM products ORDER BY products DESC" );
Later in the script the $result variable is being used like this:
Code: Select all
while ($row = mysql_fetch_assoc($result))
The script works fine if I remove the ORDER BY products DESC in the $result variable. Like this:
Code: Select all
$result = mysql_query( "SELECT * FROM products" );
Zeceer
Forum Contributor
Posts: 136 Joined: Fri Aug 02, 2002 5:10 am
Location: Norway
Post
by Zeceer » Sat Sep 13, 2003 3:36 am
I found it out
Problem solved
JAM
DevNet Resident
Posts: 2101 Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:
Post
by JAM » Sat Sep 13, 2003 3:37 am
Just to make sure, do you have a field in you 'products' table that is named 'products'?
Ie. can you do this:
Code: Select all
$result = mysql_query( "SELECT products FROM products ORDER BY products DESC" );