Closed Thread Icon

Topic awaiting preservation: ORDER BY in PHP/MySQL (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=12242" title="Pages that link to Topic awaiting preservation: ORDER BY in PHP/MySQL (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: ORDER BY in PHP/MySQL <span class="small">(Page 1 of 1)</span>\

 
Pugzly
Paranoid (IV) Inmate

From: 127.0.0.1
Insane since: Apr 2000

posted posted 05-31-2002 16:14

I have a select statement like this:
select * from articles order by print_counter $sortdir LIMIT $start , $display

Based on a content management system I wrote, I could have a query such as:
select * from articles order by print_counter desc LIMIT 0 , 29

But I'm getting a SQL query error. If I go into phpmyadmin, and run a query of say:
select * from articles order by print_counter, then phpadmin returns a page with this query:

select * from articles order by print_counter desc LIMIT 0, 30 with all the info I need.

If I COPY AND PASTE this same query into another query in phpmyadmin, I again get a query error.

I can't seem to see what's going on. It's the copy/paste error that really baffles me. I've made sure everything is spelled right, field names are right, etc.



[This message has been edited by Pugzly (edited 05-31-2002).]

Emperor
Maniac (V) Mad Scientist with Finglongers

From: Cell 53, East Wing
Insane since: Jul 2001

posted posted 05-31-2002 17:15

Pugzly: That sounds very odd and i was happening to me my first thought would be that it was PHPmMyAdmin - can you instal the latest version or perhaps use an alternative MySQl interface?

___________________
Emps

FAQs: Emperor

Pugzly
Paranoid (IV) Inmate

From: 127.0.0.1
Insane since: Apr 2000

posted posted 05-31-2002 17:41

Actually, the first part has been resolved. But the copy/paste thing is still bugging me....

Dark Phoenix
Paranoid (IV) Inmate

From: Harrow, Ontario, Canada
Insane since: Feb 2002

posted posted 05-31-2002 19:50

Last time I checked, MySQL queries are case sensitive; try either one of these:

SELECT * FROM articles ORDER BY print_counter DESC LIMIT 0, 30

select * from articles order by print_counter desc limit 0, 30

"No one's going to give you a map; you've got to walk your own path." - Hot Ice Hilda, Outlaw Star.

mr.maX
Maniac (V) Mad Scientist

From: Belgrade, Serbia
Insane since: Sep 2000

posted posted 05-31-2002 20:51

Pugzly, regarding copy/paste problem - are you using the latest version of phpMyAdmin?


bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 06-01-2002 02:20

I want to say too that sometimes with copy paste you get garbage space and hard return characters in form fields that can mess up queries they end up like

select * from whatever where x = '33 '

where you can't see the space after the 33.



.:[ The Tao of Steve ]:.
Be Desireless
Be Excellent
Be Gone
...................................

« BackwardsOnwards »

Show Forum Drop Down Menu