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 post
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 post
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 post
Share on other sites
  • 1 month later...

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

 

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...