MySQL order by error in PHP

Posted by theflyinghaiwian on Stack Overflow See other posts from Stack Overflow or by theflyinghaiwian
Published on 2010-04-24T20:17:59Z Indexed on 2010/04/24 20:23 UTC
Read the original article Hit count: 210

Filed under:
|
|

Hi, I'm making a simple cms system for a site I'm making for non-tech users to edit... So far so good but when I try and run this code I keep getting: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''pages' ORDER BY 'pages'.'pageOrder' ASC LIMIT 0 , 30' at line 1

By the error it looks like a problem with the order by section and indeed it works without it...

$sql = "SELECT * FROM 'pages' ORDER BY 'pages'.'pageOrder' ASC LIMIT 0 , 30";

$result = mysql_query($sql) or die(mysql_error());

Now I know there is nothing wrong with the code because originally I wrote my own SQL but then after it failed I robbed some from phpmyadmin and it still gives the error but it works in phpmyadmin... I'm really at my wits end with this, help is very much appreciated thank you...

© Stack Overflow or respective owner

Related posts about php

Related posts about mysql