Chill_user Posted January 24, 2020 Share Posted January 24, 2020 (edited) Hello, here is my code: $result = Db::getInstance()->getRow(' SELECT `id_category` FROM `'._DB_PREFIX_.'category_group` WHERE `id_category` = '.$id_category' AND `id_group` = '.$id_customer' '); But I have an error! If I delete 'AND' statement line, all is working (valid code) Tried to send this request with "Advanced Parameters -> Database -> SQL" and all is working well! (of course I changed $id_category and $id_customer for numbers) What is the problem with code? Edited January 24, 2020 by Amantha Bill (see edit history) Link to comment Share on other sites More sharing options...
Nishith Nesdiya Posted January 24, 2020 Share Posted January 24, 2020 Hi.. use this code may be help not tested i hope its wrok $query = 'SELECT id_category FROM `'._DB_PREFIX_.'category_group` WHERE `id_category` = '.$id_category.' AND `id_group` = '.$id_customer; $result = Db::getInstance()->getRow($query); Thanks 1 Link to comment Share on other sites More sharing options...
Chill_user Posted January 24, 2020 Author Share Posted January 24, 2020 10 minutes ago, Nishith said: Hi.. use this code may be help not tested i hope its wrok $query = 'SELECT id_category FROM `'._DB_PREFIX_.'category_group` WHERE `id_category` = '.$id_category.' AND `id_group` = '.$id_customer; $result = Db::getInstance()->getRow($query); Thanks Thanks 4 quick reply! Yes, it's working! But I didn't understand what was incorrect in my code... Link to comment Share on other sites More sharing options...
Knowband Plugins Posted January 25, 2020 Share Posted January 25, 2020 Hi, Kindly refer to line below for the error (& Differences). Your Code: SELECT `id_category` FROM `'._DB_PREFIX_.'category_group` WHERE `id_category` = '.$id_category' AND `id_group` = '.$id_customer' It should be SELECT `id_category` FROM `'._DB_PREFIX_.'category_group` WHERE `id_category` = '.$id_category.' AND `id_group` = '.$id_customer.' (Dot after the $id_category & $id_customer) 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now