Jump to content

Recommended Posts

hey W3S! Been a while! :D

Anyhow, i have a question regarding my SQL... not sure, since it's been a while.

So i am running latest version of WinginX with PHP 7.1 and PhpMyAdmin latest version all...

i tried to run this SQL, which usually works:

                    SELECT
                        p1_c_c_id AS id,
                        p1_c_c_name AS name,
                        p1_c_c_level AS level,
                        p1_c_c_order AS order
                    FROM
                        plugin1_class_categories
                    ORDER BY order ASC

and i got the error below:

Fatal error: Uncaught Error: Call to a member function fetch_assoc() on boolean in <path> Stack trace: #0 {main} thrown in <path> on line 131

so then i went nuts and went to the PhpMyAdmin sql builder and it builded this for me:

                    SELECT
                        `p1_c_c_id` AS `id`,
                        `p1_c_c_name` AS `name`,
                        `p1_c_c_level` AS `level`,
                        `p1_c_c_order` AS `order`
                    FROM
                        `plugin1_class_categories`
                        ORDER BY `p1_c_c_order` ASC

and that works? Only difference is the plinges... the (')... why? The other one usually works also right? Or am i remembering wrong? Tried to read a little bit about it but gave no sence since it's been a while with everything hehe :P

 

Well thanks if you can help me anyways! Thanks in advance! :)

Link to comment
Share on other sites

hmm... i tried to remove to ORDER from the SQL also but didn't work for some reason, which is why i'm kinda confused.. should be working. Or at least that is what i remember that it should :/...

Link to comment
Share on other sites

ORDER BY order

You should have noticed that when you were writing the code, ORDER is obviously a reserved word.  If you're going to use reserved words as identifiers then you need to surround them with backticks so that MySQL knows you are referring to an identifier instead of the reserved word.

Link to comment
Share on other sites

  • 1 month later...

ok fail i have fixed the problem haha xD Thx a lot guys! xD

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...